[web2py] Re: rotatingfilehandler logging not working in windows

2020-02-08 Thread Jon Subscripted
Hi everyone,
I've just found out that the application is actually logging correctly but
not using "web2py/logs" folder.
Thanks, Jon.

On Sat, Feb 8, 2020 at 11:53 AM Jon Subscripted 
wrote:

> Hi everyone,
> I've still haven't figured out what I do wrong.
>
> Should I specifically use "-l LOGFILENAME" option for the command, as in
> the example below?
>
> C:\Users\jonsubscriptions\web2py_src\web2py>python.exe web2py.py -l
> web2py.log
>
> I've tried but see no change in behaviour.
> Thanks, Jon.
>
> On Wed, Feb 5, 2020 at 6:35 PM Jon Subscripted 
> wrote:
>
>> Important detail. There's a typo in my previous email (but NOT in the
>> logging configuration file name). The logging configuration file name is
>> correctly named "logging.conf".
>> Thanks, Jon.
>>
>> On Wed, Feb 5, 2020 at 6:26 PM Jon Subscripted <
>> jonsubscripti...@gmail.com> wrote:
>>
>>> Hi everyone,
>>> I'm trying to send myapps log to the rotatingfilehandler but something
>>> fails. It does log in the console but not in the file. web2py/logs folder
>>> is empty.
>>>
>>> For simplicity I'm using the "welcome" application.
>>>
>>> 1) I'm running web2py (version
>>> 2.18.5-stable+timestamp.2019.04.08.04.22.03) from source code on Windows.
>>> (Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:19:30))
>>>
>>> 2) I copied "logging.example.conf" to web2py directory renaming it as
>>> "logging.conf".
>>>
>>> 3) In "looging.conf" I have this configuration:
>>>
>>> # welcome app handler
>>> [logger_welcome]
>>> level=DEBUG
>>> qualname=web2py.app.welcome
>>> handlers=consoleHandler,rotatingFileHandler
>>> propagate=0
>>>
>>> ...
>>>
>>> # Rotating file handler
>>> #   mkdir logs in the web2py base directory if not already present
>>> #   args: (filename[, mode[, maxBytes[, backupCount[, encoding[,
>>> delay])
>>> #
>>> [handler_rotatingFileHandler]
>>> class=handlers.RotatingFileHandler
>>> level=DEBUG
>>> formatter=simpleFormatter
>>> args=("web2py.log", "a", 100, 5)
>>>
>>> ...
>>>
>>> [formatter_simpleFormatter]
>>> format=%(asctime)s - %(name)s - %(levelname)s - %(message)s
>>> datefmt='%m/%d/%Y %I:%M:%S %p'
>>>
>>> 4) Since there is already a "web2py/logs" folder I did not create a new
>>> one.
>>>
>>> 5) In default.py I added the following code:
>>>
>>> import logging
>>> logger = logging.getLogger("web2py.app.welcome")
>>> logger.setLevel(logging.DEBUG)
>>>
>>> details = 'details'
>>>
>>> #  example index page 
>>> def index():
>>> logger.debug("Just checking that %s", details)
>>> logger.info("You ought to know that %s", details)
>>> logger.warn("Mind that %s", details)
>>> logger.error("Oops, something bad happened %s", details)
>>> response.flash = T("Hello World")
>>> return dict(message=T('Welcome to web2py!'))
>>>
>>> 6) This is what I get:
>>> "C:\Users\jonsubscriptions\Downloads\web2py_src
>>> (1)\web2py>C:\Python27\python.exe web2py.py
>>> web2py Web Framework
>>> Created by Massimo Di Pierro, Copyright 2007-2020
>>> Version 2.18.5-stable+timestamp.2019.04.08.04.22.03
>>> Database drivers available: sqlite3, imaplib, pyodbc, pymysql
>>> please visit:
>>> ('\t', 'http://127.0.0.1:8000/')
>>> starting browser...
>>> '02/05/2020 05:45:33 PM' - web2py.app.welcome - WARNING - Mind that
>>> details
>>> '02/05/2020 05:45:33 PM' - web2py.app.welcome - ERROR - Oops, something
>>> bad happened details"
>>>
>>> I get messages in the console but rotatingfilehandler does not work
>>> properly.
>>> What am I missing or doing wrong?
>>> What do I need to do to log into file "web2py.log"?
>>> Thanks, Jon.
>>>
>>> PS. My plan is to implement the logging in Pythonanywhere but as it is
>>> not working even locally I started from the very scratch...
>>>
>>

-- 
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/CAK8tz30y7QZEccDCjAa2vNHd7keqE4H8uRRoohkoUvKw54xPKQ%40mail.gmail.com.


[web2py] Re: rotatingfilehandler logging not working in windows

2020-02-08 Thread Jon Subscripted
Hi everyone,
I've still haven't figured out what I do wrong.

Should I specifically use "-l LOGFILENAME" option for the command, as in
the example below?

C:\Users\jonsubscriptions\web2py_src\web2py>python.exe web2py.py -l
web2py.log

I've tried but see no change in behaviour.
Thanks, Jon.

On Wed, Feb 5, 2020 at 6:35 PM Jon Subscripted 
wrote:

> Important detail. There's a typo in my previous email (but NOT in the
> logging configuration file name). The logging configuration file name is
> correctly named "logging.conf".
> Thanks, Jon.
>
> On Wed, Feb 5, 2020 at 6:26 PM Jon Subscripted 
> wrote:
>
>> Hi everyone,
>> I'm trying to send myapps log to the rotatingfilehandler but something
>> fails. It does log in the console but not in the file. web2py/logs folder
>> is empty.
>>
>> For simplicity I'm using the "welcome" application.
>>
>> 1) I'm running web2py (version
>> 2.18.5-stable+timestamp.2019.04.08.04.22.03) from source code on Windows.
>> (Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:19:30))
>>
>> 2) I copied "logging.example.conf" to web2py directory renaming it as
>> "logging.conf".
>>
>> 3) In "looging.conf" I have this configuration:
>>
>> # welcome app handler
>> [logger_welcome]
>> level=DEBUG
>> qualname=web2py.app.welcome
>> handlers=consoleHandler,rotatingFileHandler
>> propagate=0
>>
>> ...
>>
>> # Rotating file handler
>> #   mkdir logs in the web2py base directory if not already present
>> #   args: (filename[, mode[, maxBytes[, backupCount[, encoding[,
>> delay])
>> #
>> [handler_rotatingFileHandler]
>> class=handlers.RotatingFileHandler
>> level=DEBUG
>> formatter=simpleFormatter
>> args=("web2py.log", "a", 100, 5)
>>
>> ...
>>
>> [formatter_simpleFormatter]
>> format=%(asctime)s - %(name)s - %(levelname)s - %(message)s
>> datefmt='%m/%d/%Y %I:%M:%S %p'
>>
>> 4) Since there is already a "web2py/logs" folder I did not create a new
>> one.
>>
>> 5) In default.py I added the following code:
>>
>> import logging
>> logger = logging.getLogger("web2py.app.welcome")
>> logger.setLevel(logging.DEBUG)
>>
>> details = 'details'
>>
>> #  example index page 
>> def index():
>> logger.debug("Just checking that %s", details)
>> logger.info("You ought to know that %s", details)
>> logger.warn("Mind that %s", details)
>> logger.error("Oops, something bad happened %s", details)
>> response.flash = T("Hello World")
>> return dict(message=T('Welcome to web2py!'))
>>
>> 6) This is what I get:
>> "C:\Users\jonsubscriptions\Downloads\web2py_src
>> (1)\web2py>C:\Python27\python.exe web2py.py
>> web2py Web Framework
>> Created by Massimo Di Pierro, Copyright 2007-2020
>> Version 2.18.5-stable+timestamp.2019.04.08.04.22.03
>> Database drivers available: sqlite3, imaplib, pyodbc, pymysql
>> please visit:
>> ('\t', 'http://127.0.0.1:8000/')
>> starting browser...
>> '02/05/2020 05:45:33 PM' - web2py.app.welcome - WARNING - Mind that
>> details
>> '02/05/2020 05:45:33 PM' - web2py.app.welcome - ERROR - Oops, something
>> bad happened details"
>>
>> I get messages in the console but rotatingfilehandler does not work
>> properly.
>> What am I missing or doing wrong?
>> What do I need to do to log into file "web2py.log"?
>> Thanks, Jon.
>>
>> PS. My plan is to implement the logging in Pythonanywhere but as it is
>> not working even locally I started from the very scratch...
>>
>

-- 
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/CAK8tz33TD%2BcEQ6Fe1f2zmcwKo7tzWSUaqCedfmCWUTp5CfuM6g%40mail.gmail.com.