Commits
Sandra Castro authored 2c566636684 Merge
27 27 | else: |
28 28 | procmgr.create("logger",[casa['helpers']['logger'],logfile]) |
29 29 | |
30 30 | elif (os.uname()[0]=='Linux'): |
31 31 | procmgr.create("logger",[casa['helpers']['logger'],logfile]) |
32 32 | |
33 33 | else: |
34 34 | print 'Unrecognized OS: No logger available' |
35 35 | |
36 36 | |
37 - | thelogfile = '' |
38 - | |
39 - | if casa['files'].has_key('logfile') : |
40 - | thelogfile = casa['files']['logfile'] |
41 - | if casa['flags'].nologfile: |
42 - | thelogfile = 'null' |
43 - | |
44 37 | deploylogger = True |
45 38 | |
46 - | if not os.access('.', os.W_OK) : |
47 - | |
48 - | print "********************************************************************************" |
49 - | print "Warning: no write permission in current directory, no log files will be written." |
50 - | print "********************************************************************************" |
39 + | if not os.access('.', os.W_OK): |
40 + | if casa['flags'].nologfile == False: |
41 + | |
42 + | print "********************************************************************************" |
43 + | print "Warning: no write permission in current directory, no log files will be written." |
44 + | print "********************************************************************************" |
51 45 | deploylogger = False |
52 - | thelogfile = 'null' |
53 46 | |
54 47 | if casa['flags'].nologger : |
55 48 | deploylogger = False |
56 49 | |
57 50 | if casa['flags'].nogui : |
58 51 | deploylogger = False |
59 52 | |
60 53 | ## do not start logger gui on MPI clients... |
61 54 | if MPIEnvironment.is_mpi_enabled and not MPIEnvironment.is_mpi_client: |
62 55 | deploylogger = False |
63 56 | |
64 - | if thelogfile == 'null': |
65 - | pass |
66 - | else: |
67 - | if thelogfile.strip() != '' : |
68 - | if deploylogger: |
69 - | casalogger(thelogfile) |
70 - | else: |
71 - | thelogfile = 'casapy-'+time.strftime("%Y%m%d-%H%M%S", time.gmtime())+'.log' |
72 - | try: |
73 - | open(thelogfile, 'a').close() |
74 - | except: |
75 - | pass |
76 - | if deploylogger: |
77 - | casalogger(thelogfile) |
78 - | |
57 + | if deploylogger and casa['files']['logfile'] != '/dev/null': |
58 + | casalogger(casa['files']['logfile']) |
79 59 | |
80 60 | casalog = casac.logsink(casa['files']['logfile']) |
81 61 | |
82 62 | processor_origin = MPIEnvironment.processor_origin |
83 63 | casalog.processorOrigin(processor_origin) |
84 64 | |
85 65 | casalog.showconsole((MPIEnvironment.is_mpi_enabled and MPIEnvironment.log_to_console) or casa['flags'].log2term) |
86 66 | |
87 67 | ### |
88 68 | ### For reasons unknown, setglobal causes the global logger to steal the |