from mpi4casa.MPIEnvironment import MPIEnvironment
def casalogger(logfile=''):
Spawn a new casalogger using logfile as the filename.
You should only call this if the casalogger dies or you close it
Note: if you changed the name of the log file using casalog.setlogfile
you will need to respawn casalogger with the new log filename. Eventually,
we will figure out how to signal the casalogger with the new name but not
from casa_system import procmgr
if casa.has_key('files') and casa['files'].has_key('logfile') :
logfile = casa['files']['logfile']
casa['files']['logfile'] = os.getcwd( ) + '/casa.log'
if (os.uname()[0]=='Darwin'):
if casa['helpers']['logger'] == 'console':
procmgr.create("logger",['/usr/bin/open','-a','console', logfile])
procmgr.create("logger",[casa['helpers']['logger'],logfile])
elif (os.uname()[0]=='Linux'):
procmgr.create("logger",[casa['helpers']['logger'],logfile])
print 'Unrecognized OS: No logger available'
if not os.access('.', os.W_OK):
if casa['flags'].nologfile == False:
print "********************************************************************************"
print "Warning: no write permission in current directory, no log files will be written."
print "********************************************************************************"
if casa['flags'].nologger :
if MPIEnvironment.is_mpi_enabled and not MPIEnvironment.is_mpi_client:
if deploylogger and casa['files']['logfile'] != '/dev/null':
casalogger(casa['files']['logfile'])
if (casa['state']['telemetry-enabled']):
casalog = casac.logsink(casa['files']['logfile'], True, casa['files']['telemetry-logfile'])
casatelemetry.setCasaLog(casalog)