I create a log file this way:
global logger logger = logging.getLogger("plus_dig_cname") logger.setLevel(logging.DEBUG) fh = logging.FileHandler( fdoc_log + "/plus_dig_cname.log" ) formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') fh.setFormatter(formatter) logger.addHandler(fh)
and when plus_dig_cname.log is larger than 300 MB, I process it with a shell script, the main process:
mv $LOG_DIR/$1 $LOG_DIR/$1.bk [ $? -ne 0 ] && return 1 touch $LOG_DIR/$1 [ $? -ne 0 ] && return 1 chmod 666 $LOG_DIR/$1 [ $? -ne 0 ] && return 1
just mv and tap new.
The problem is that the registrar cannot use anything in the plus_dig_cname.log file. Logs cannot work.
Perhaps this can be solved by:
with open( "plus_dig_cname.log", "w" ): pass
this way you can get the new log file using Python. But I want to get a new Bash log file.
So why can't the log work after "mv touch chmod"?
thanks
source share