When using logging in web2py on Windows, we are unable to delete 
applications unless we first stop the server.

The reason is that the app.log is considered "in use".

As the uninstall happens from the admin app, I am not quite sure how best 
to stop the logger in the application that is being uninstalled when the 
"Uninstall" option is selected from admin.  

Anyone have any ideas on how to unistall an app that uses logging.  
Apparently this is only an issue on Windows because the os.unlink works on 
"in use" files on linux systems.

Note : We have defined the location of the log files within the application 
directory structure so that the developers have access to the files.

This is the logging code used :
def get_configured_logger(name):
    Test = False
    logger = logging.getLogger(name)
    if (len(logger.handlers) == 0):
    # This logger has no handlers, so we can assume it hasn't yet been 
configured
    # (Configure logger)

    # Create default handler
    if request.env.web2py_runtime_gae:
    # Create GAEHandler
    handler = GAEHandler()
    else:
    # Create RotatingFileHandler
    import os
    formatter="%(asctime)s %(levelname)s %(process)s %(thread)s 
%(funcName)s():%   (lineno)d %(message)s"
    handler = 
logging.handlers.RotatingFileHandler(os.path.join(request.folder,
'private/app.log'), maxBytes=1000000,backupCount=2)
handler.setFormatter(logging.Formatter(formatter))

    handler.setLevel(logging.DEBUG)

    logger.addHandler(handler)
    logger.setLevel(logging.DEBUG)

    # Test entry:

    if Test == True:
    logger.debug(name + ' logger created')
    else:
    # Test entry:
    if Test == True:
    logger.debug(name + ' already exists')

    return logger

-- 
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/c9b3c32c-6cfc-4b5f-9894-a62d16898ea5n%40googlegroups.com.

Reply via email to