<https://lh5.googleusercontent.com/-wBupMd3-Uco/UbCUiHnA49I/AAAAAAAAAW8/waf7MRfgyvc/s1600/Screen+Shot+2013-06-06+at+9.53.24+AM.png>
Just wanted to share this. 


Good news, I actually got this to work on localhost...
and it was pretty easy.

I wanted to use "logging"while doing a lot of testing, and I didn't want to 
send 
out real emails.

>From Docs:
*For debugging purposes you can set
mail.settings.server = 'logging'
   and emails will not be sent but logged to the console instead.


*Here are steps

   1. I thought the file logging.example.conf was distributed with latest 
   version of web2py, but I couldn't find it, so I got it from:
   
   https://github.com/web2py/web2py/blob/master/logging.example.conf
   
   2. The instructions were quite clear, in the .conf file, so I followed 
   them- I wasn't sure about where to put it... see screen shot below.
   
   3. I added my app called "sig" to the  logging.conf file  - below - just 
   search for "sig" and you'll see ALL the changes I made.
   

TIP
On my Mac, I didn't use Terminal to view the .log file,  I used Console.app 
which worked well (screen shot below)





<https://lh3.googleusercontent.com/-VFgDlxr8KmQ/UbCTbt_oP-I/AAAAAAAAAWg/y-GHxmUs1E8/s1600/Screen+Shot+2013-06-06+at+9.47.48+AM.png>

<https://lh4.googleusercontent.com/-3WnOXlD88GA/UbCToLnbWuI/AAAAAAAAAWo/khUe86DohQc/s1600/console.png>


Here is my logging.conf - but you should start with logging.example.conf





# Configure the Python logging facility.
# To use this file, copy it to logging.conf and edit logging.conf as 
required.
# See http://docs.python.org/library/logging.html for details of the 
logging facility.
# Note that this is not the newer logging.config facility.
#
# The default configuration is console-based (stdout) for backward 
compatibility;
# edit the [handlers] section to choose a different logging destination.
#
# Note that file-based handlers are thread-safe but not mp-safe;
# for mp-safe logging, configure the appropriate syslog handler.
#
# To create a configurable logger for application 'myapp', add myapp to
# the [loggers] keys list and add a [logger_myapp] section, using
# [logger_welcome] as a starting point.
#
# In your application, create your logger in your model or in a controller:
#
# import logging
# logger = logging.getLogger("web2py.app.myapp")
# logger.setLevel(logging.DEBUG)
#
# To log a message:
#
# logger.debug("You ought to know that %s" % details)
#
# Note that a logging call will be governed by the most restrictive level
# set by the setLevel call, the [logger_myapp] section, and the 
[handler_...]
# section. For example, you will not see DEBUG messages unless all three are
# set to DEBUG.
#
# Available levels: DEBUG INFO WARNING ERROR CRITICAL

[loggers]
keys=root,rocket,markdown,web2py,rewrite,cron,app,welcome,sig

[handlers]
keys=consoleHandler,messageBoxHandler,rotatingFileHandler
#keys=consoleHandler,rotatingFileHandler
#keys=osxSysLogHandler
#keys=notifySendHandler

[formatters]
keys=simpleFormatter

[logger_root]
level=WARNING
handlers=consoleHandler,rotatingFileHandler

[logger_web2py]
level=WARNING
handlers=consoleHandler,rotatingFileHandler
qualname=web2py
propagate=0

# URL rewrite logging (routes.py)
# See also the logging parameter in routes.py
#
[logger_rewrite]
level=WARNING
qualname=web2py.rewrite
handlers=consoleHandler,rotatingFileHandler
propagate=0

[logger_cron]
level=WARNING
qualname=web2py.cron
handlers=consoleHandler,rotatingFileHandler
propagate=0

# generic app handler
[logger_app]
level=WARNING
qualname=web2py.app
handlers=consoleHandler,rotatingFileHandler
propagate=0

# welcome app handler
[logger_welcome]
level=WARNING
qualname=web2py.app.welcome
handlers=consoleHandler,rotatingFileHandler
propagate=0

# welcome app handler
[logger_sig]
level=WARNING
qualname=web2py.app.sig
handlers=consoleHandler,rotatingFileHandler
propagate=0

# loggers for legacy getLogger calls: Rocket and markdown
[logger_rocket]
level=WARNING
handlers=consoleHandler,messageBoxHandler,rotatingFileHandler
qualname=Rocket
propagate=0

[logger_markdown]
level=WARNING
handlers=consoleHandler,rotatingFileHandler
qualname=markdown
propagate=0

[handler_consoleHandler]
class=StreamHandler
level=WARNING
formatter=simpleFormatter
args=(sys.stdout,)

[handler_messageBoxHandler]
class=gluon.messageboxhandler.MessageBoxHandler
level=ERROR
formatter=simpleFormatter
args=()

[handler_notifySendHandler]
class=gluon.messageboxhandler.NotifySendHandler
level=ERROR
formatter=simpleFormatter
args=()

# 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=("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=





<https://lh3.googleusercontent.com/-VFgDlxr8KmQ/UbCTbt_oP-I/AAAAAAAAAWg/y-GHxmUs1E8/s1600/Screen+Shot+2013-06-06+at+9.47.48+AM.png>

-- 

--- 
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.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to