On Aug 29, 2010, at 6:24 PM, mart wrote:
>
> hey again...
>
> So, I should have looked a little deeper earlier when I saw it working
> but still getting the error/warning...
>
> so, not too sure what's happening right now (will deeper later this
> evening).
>
> but for now. I synced the src from same location specified at the
> beginning of the thread. extracted in a different location as
> yesterday's instance. the web2py_path/gluon/main.py does not contain
> your new else statement, but the older version:
>
> logpath = os.path.join(web2py_path, "logging.conf")
> if os.path.exists(logpath):
> logging.config.fileConfig(os.path.join(web2py_path,
> "logging.conf"))
> logger = logging.getLogger("web2py")
>
> and no logging.conf exists.
Just for the record: the release will have logging.example.conf, which you'll
need to copy to logging.conf to have it take effect.
But the change to main.py should give a (possibly) reasonable default in the
absence of a logging.conf, as long as it's possible to write to stdout.
>
> I noticed that os.environ is being used to set cwd, so I checked the
> output, which gives me this:
I'm suspicious of the cwd logic, too. But that's (maybe) a question for another
day.
>
> macmart:web2py_2_184 mart$ python
> Python 2.7 (r27:82508, Jul 3 2010, 21:12:11)
> [GCC 4.0.1 (Apple Inc. build 5493)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import os
>>>> for item in os.environ:
> ... print("{0} = {1}".format(item,os.environ[item]))
> ...
> LANG = en_CA.UTF-8
> TERM = xterm-color
> Apple_PubSub_Socket_Render = /tmp/launch-nyryAG/Render
> SHLVL = 1
> OLDPWD = /Users/mart/Downloads
> SSH_AUTH_SOCK = /tmp/launch-xtTLKc/Listeners
> TERM_PROGRAM_VERSION = 273
> __CF_USER_TEXT_ENCODING = 0x1F6:0:0
> PWD = /Users/mart/Downloads/web2py_2_184
> SHELL = /bin/bash
> LOGNAME = mart
> USER = mart
> HOME = /Users/mart
> PATH = /Library/Frameworks/Python.framework/Versions/2.7/bin:/Library/
> Frameworks/Python.framework/Versions/2.6/bin:/usr/bin:/bin:/usr/sbin:/
> sbin:/usr/local/bin:/usr/local/git/bin:/usr/X11/bin
> COMMAND_MODE = unix2003
> _ = /Library/Frameworks/Python.framework/Versions/2.7/bin/python
> DISPLAY = /tmp/launch-fj9Ipo/org.x:0
> TMPDIR = /var/folders/gL/gLsicOEFGNC3VqZE1yVgmU+++TM/-Tmp-/
> TERM_PROGRAM = Apple_Terminal
>>>>
>
>
>
> So, no mention of previous web2py install path (unless I;m not looking
> correctly), but it still works. To be sure, I renamed the previous
> web2py's folder name (just in case, something had picked it up)... but
> still working (and getting the warning)...
>
> So, not too sure why this isn't failing as it did, this morning...
>
> Thanks,
> Mart :)
>
>
>
>
> On Aug 29, 6:59 pm, Jonathan Lundell <[email protected]> wrote:
>> On Aug 29, 2010, at 3:40 PM, mart wrote:
>>
>>
>>
>>> Just downloaded src from same location. All is working great :)
>>> however... i am still weeing the warning 'No handlers could be found
>>> for logger "web2py"'
>>
>> Do have a logging.conf, and/or do you see the change in main.py?
>>
>>
>>
>>> thanks,
>
>>> Mart :)
>>
>>> On Aug 29, 6:34 pm, mart <[email protected]> wrote:
>>>> Any time :)
>>
>>>> On Aug 29, 4:40 pm, Jonathan Lundell <[email protected]> wrote:
>>
>>>>> On Aug 29, 2010, at 11:12 AM, mart wrote:
>>
>>>>>> hey Jonathan,
>>
>>>>>> renamed logging.conf to logging_x.conf, modified main.py, and re-ran
>>>>>> web2py. Worked great for me! :)
>>
>>>>> Thanks, I appreciate it.
>>
>>>>>> Thanks,
>>>>>> Mart :)
>>
>>>>>> On Aug 29, 1:42 pm, Jonathan Lundell <[email protected]> wrote:
>>>>>>> On Aug 29, 2010, at 10:26 AM, mart wrote:
>>
>>>>>>>> Working great now! Thanks for that :)
>>
>>>>>>> A favor, please, Mart. In main.py, you'll find this logging init code:
>>
>>>>>>> logpath = os.path.join(web2py_path, "logging.conf")
>>>>>>> if os.path.exists(logpath):
>>>>>>> logging.config.fileConfig(os.path.join(web2py_path, "logging.conf"))
>>>>>>> logger = logging.getLogger("web2py")
>>
>>>>>>> In the configuration that terminates for you (2.7 and no logging.conf,
>>>>>>> I believe), try adding an else clause to the above, thus:
>>
>>>>>>> logpath = os.path.join(web2py_path, "logging.conf")
>>>>>>> if os.path.exists(logpath):
>>>>>>> logging.config.fileConfig(os.path.join(web2py_path, "logging.conf"))
>>>>>>> else:
>>>>>>> logging.basicConfig()
>>>>>>> logger = logging.getLogger("web2py")
>>
>>>>>>> Hopefully that will solve the termination problem, in which case we'll
>>>>>>> want that patch for 2.7 (and it should do no harm before that). I have
>>>>>>> to think it's a 2.7 bug, but who knows?
>>
>>>>>>> Also, Mart, can you try that python command-line test under 2.7?
>>
>>>>>>>> On Aug 29, 1:06 pm, Jonathan Lundell <[email protected]> wrote:
>>>>>>>>> On Aug 29, 2010, at 9:46 AM, mart wrote:
>>
>>>>>>>>>> So, I just downloaded the src
>>>>>>>>>> fromhttp://web2py.com/examples/static/nightly/web2py_src.zip,
>>>>>>>>>> just in case there are changes since last night. I am on mac os
>>>>>>>>>> 10.6.4
>>>>>>>>>> and this is what I get (copied from terminal):
>>
>>>>>>>>>> macmart:web2py_184 mart$ python web2py.py
>>>>>>>>>> Warning: web2py requires Python 2.4, 2.5 (recommended), or 2.6 but
>>>>>>>>>> you
>>>>>>>>>> are running:
>>>>>>>>>> 2.7 (r27:82508, Jul 3 2010, 21:12:11)
>>>>>>>>>> [GCC 4.0.1 (Apple Inc. build 5493)]web2py Enterprise Web Framework
>>>>>>>>>> Created by Massimo Di Pierro, Copyright 2007-2010
>>>>>>>>>> Version 1.84.0 (2010-08-29 06:19:04)
>>>>>>>>>> Database drivers available: SQLite3
>>>>>>>>>> Starting hardcron...
>>>>>>>>>> No handlers could be found for logger "web2py"
>>>>>>>>>> choose a password:*********
>>>>>>>>>> please visit:
>>>>>>>>>> http://127.0.0.1:8000
>>>>>>>>>> use "kill -SIGTERM 1746" to shutdown the web2py server
>>>>>>>>>> macmart:web2py_184 mart$
>>
>>>>>>>>>> So, we still notice the same error "No handlers could be found for
>>>>>>>>>> logger "web2py"" and the I am brought back to the terminal cursor.
>>
>>>>>>>>>> So, now on to Jonathan's suggestion.
>>
>>>>>>>>>> SO, now I/ looking for logging.example.conf but can't find it, does
>>>>>>>>>> it
>>>>>>>>>> usually come with the src? Or what should the contents be? I did see
>>>>>>>>>> some references to that file in a few place though...
>>
>>>>>>>>> It should be in the root directory, as part of the distribution (it's
>>>>>>>>> a new file); if it's not, it must have something to do with how the
>>>>>>>>> distribution is created. Massimo?
>>
>>>>>>>>> In the meantime, try the following (plain text file):
>>
>>>>>>>>> [loggers]
>>>>>>>>> keys=root,rocket,markdown,web2py,rewrite,app,welcome
>>
>>>>>>>>> # the default configuration is console-based (stdout) for backward
>>>>>>>>> compatibility
>>>>>>>>> #
>>>>>>>>> # note that file-based handlers are thread-safe but not mp-safe;
>>>>>>>>> # for mp-safe logging, configure the appropriate syslog handler
>>
>>>>>>>>> [handlers]
>>>>>>>>> keys=consoleHandler
>>>>>>>>> #keys=consoleHandler,rotatingFileHandler
>>>>>>>>> #keys=osxSysLogHandler
>>
>>>>>>>>> [formatters]
>>>>>>>>> keys=simpleFormatter
>>
>>>>>>>>> [logger_root]
>>>>>>>>> level=WARNING
>>>>>>>>> handlers=consoleHandler
>>
>>>>>>>>> [logger_web2py]
>>>>>>>>> level=WARNING
>>>>>>>>> handlers=consoleHandler
>>>>>>>>> qualname=web2py
>>>>>>>>> propagate=0
>>
>>>>>>>>> [logger_rewrite]
>>>>>>>>> level=WARNING
>>>>>>>>> qualname=web2py.rewrite
>>>>>>>>> handlers=consoleHandler
>>>>>>>>> propagate=0
>>
>>>>>>>>> # generic app handler
>>>>>>>>> [logger_app]
>>>>>>>>> level=WARNING
>>>>>>>>> qualname=web2py.app
>>>>>>>>> handlers=consoleHandler
>>>>>>>>> propagate=0
>>
>>>>>>>>> # welcome app handler
>>>>>>>>> [logger_welcome]
>>>>>>>>> level=WARNING
>>>>>>>>> qualname=web2py.app.welcome
>>>>>>>>> handlers=consoleHandler
>>>>>>>>> propagate=0
>>
>>>>>>>>> # loggers for legacy getLogger calls: Rocket and markdown
>>>>>>>>> [logger_rocket]
>>>>>>>>> level=WARNING
>>>>>>>>> handlers=consoleHandler
>>>>>>>>> qualname=Rocket
>>>>>>>>> propagate=0
>>
>>>>>>>>> [logger_markdown]
>>>>>>>>> level=WARNING
>>>>>>>>> handlers=consoleHandler
>>>>>>>>> qualname=markdown
>>>>>>>>> propagate=0
>>
>>>>>>>>> [handler_consoleHandler]
>>>>>>>>> class=StreamHandler
>>>>>>>>> level=WARNING
>>>>>>>>> formatter=simpleFormatter
>>>>>>>>> args=(sys.stdout,)
>>
>>>>>>>>> # 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=INFO
>>>>>>>>> formatter=simpleFormatter
>>>>>>>>> args=("logs/web2py.log", "a", 1000000, 5)
>>
>>>>>>>>> [handler_osxSysLogHandler]
>>>>>>>>> class=handlers.SysLogHandler
>>>>>>>>> level=WARNING
>>>>>>>>> formatter=simpleFormatter
>>>>>>>>> args=("/var/run/syslog", handlers.SysLogHandler.LOG_DAEMON)
>>
>>>>>>>>> [handler_linuxSysLogHandler]
>>>>>>>>> class=handlers.SysLogHandler
>>>>>>>>> level=WARNING
>>>>>>>>> formatter=simpleFormatter
>>>>>>>>> args=("/dev/log", handlers.SysLogHandler.LOG_DAEMON)
>>
>>>>>>>>> [handler_remoteSysLogHandler]
>>>>>>>>> class=handlers.SysLogHandler
>>>>>>>>> level=WARNING
>>>>>>>>> formatter=simpleFormatter
>>>>>>>>> args=(('sysloghost.domain.com', handlers.SYSLOG_UDP_PORT),
>>>>>>>>> handlers.SysLogHandler.LOG_DAEMON)
>>
>>>>>>>>> [formatter_simpleFormatter]
>>>>>>>>> format=%(asctime)s - %(name)s - %(levelname)s - %(message)s
>>>>>>>>> datefmt=
>>
>>