We have activated logging in our applications and have defined 2 back-ups 
for the rotation.

We often get errors when running web2py shell scripts because I think that 
the the web2py web application and the web2py shell script are both trying 
to access the log file.  It looks like it is trying to perform a rotation 
at the moment of the error.

Can anyone give me an idea on how we can resolve with this conflict without 
disabling rotation?

Here is the full output:
--- Logging error ---
Traceback (most recent call last):
  File "D:\Python\Miniconda3\envs\web2py_XYZ\lib\logging\handlers.py", line 
74, in emit
    self.doRollover()
  File "D:\Python\Miniconda3\envs\web2py_XYZ\lib\logging\handlers.py", line 
177, in doRollover
    self.rotate(self.baseFilename, dfn)
  File "D:\Python\Miniconda3\envs\web2py_XYZ\lib\logging\handlers.py", line 
115, in rotate
    os.rename(source, dest)
PermissionError: [WinError 32] The process cannot access the file because 
it is being used by another process: 
'D:\\Data\\XYZ\\applications\\MyApp\\private\\app.log' -> 
'D:\\Data\\XYZ\\applications\\MyApp\\private\\app.log.1'
Call stack:
  File "D:\Data\XYZ\web2py.py", line 58, in <module>
    gluon.widget.start()
  File "D:\Data\XYZ\gluon\widget.py", line 746, in start
    run(options.shell, plain=options.plain, bpython=options.bpython,
  File "D:\Data\XYZ\gluon\shell.py", line 280, in run
    _env = env(a, c=c, f=f, import_models=import_models, 
extra_request=extra_request)
  File "*D:\Data\XYZ\gluon\shell.py"*, line 181, in env
    run_models_in(environment)
  File "D:\Data\XYZ\gluon\compileapp.py", line 563, in run_models_in
    restricted(ccode, environment, layer=model)
  File "D:\Data\XYZ\gluon\restricted.py", line 219, in restricted
    exec(ccode, environment)
  File "applications\MyApp\models\b_console.py", line 153, in <module>
    console.log(source='b_console.py', message=str(console), 
add_timestamp=True)
  File "applications\MyApp\models\b_console.py", line 147, in log
    logger.debug(msg=out_log)

Thanks in advance,
David

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/02c810ee-98e8-498b-acca-b7f389b6d3fbn%40googlegroups.com.

Reply via email to