Ah, i see. Can you temporarily shutdown() the logger and then restart it
when the uninstall is complete? Or does it need to stay running also? I
think it is possible to close a specific handler as well - but i dont know
how the logging works in web2py - maybe there is a single handler for all
the apps (if you can't tell, i have never used it before :)

___________________________
*www.TenOutOfTen.org* <https://www.TenOutOfTen.org>
[email protected]
(+95) 09 250018669 (Myanmar)



On Mon, 26 Oct 2020 at 23:37, Davidiam <[email protected]> wrote:

> Thank you for your reply,
> Deleting the application folder gives the same error.
> The problem is that the logger holds the log file locked.  If I restart
> the webserver I can delete the file, but our developers can't restart web
> services.
> It is not a big problem but I would like to find a solution (if one
> exists)..
>
> On Monday, October 26, 2020 at 4:56:30 AM UTC+1 [email protected] wrote:
>
>> Hi David
>>
>> I am not sure that i have ever used the Uninstall option. I just delete
>> the application folder and the application disappears. I am not sure if
>> that leaves any residual information in files somewhere. But i have not
>> noticed a problem.
>>
>> Does that work for you?
>> Andrew
>>
>> ___________________________
>> *www.TenOutOfTen.org* <https://www.TenOutOfTen.org>
>> [email protected]
>> (+95) 09 250018669 <+95%209%20250%20018%20669> (Myanmar)
>>
>>
>>
>> On Fri, 23 Oct 2020 at 17:07, Davidiam <[email protected]> wrote:
>>
>>> 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 [email protected].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/web2py/c9b3c32c-6cfc-4b5f-9894-a62d16898ea5n%40googlegroups.com
>>> <https://groups.google.com/d/msgid/web2py/c9b3c32c-6cfc-4b5f-9894-a62d16898ea5n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/4af7b1b3-1161-4252-80fe-0f89e125db82n%40googlegroups.com
> <https://groups.google.com/d/msgid/web2py/4af7b1b3-1161-4252-80fe-0f89e125db82n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CACWMBMPkdmRdOUGqUJgaB%2BdC19%3DfC4pFBYzQ9rhfFNegwRhsNQ%40mail.gmail.com.

Reply via email to