I use this for logging which I found here awhile back:
def _init_log():
import os,logging,logging.handlers,time
logger = logging.getLogger(request.application)
logger.setLevel(logging.INFO)
handler = logging.handlers.RotatingFileHandler(os.path.join(
request.folder,'logs','applog.log'),'a',1024*1024,1)
handler.setLevel(logging.INFO) #or DEBUG
handler.setFormatter(logging.Formatter(
'%(asctime)s %(levelname)s %(filename)s %(lineno)d %(funcName)s():
%(message)s'))
logger.addHandler(handler)
return logger
app_logging = cache.ram('app_wide_log',lambda:_init_log(),time_expire=None)
Then in your code:
app_logging.info('log this info')
On Thursday, September 20, 2012 3:13:51 PM UTC-7, monotasker wrote:
>
> Great, thanks. I was getting confused with php and javascript logging,
> where the 'console' often refers to something like firebug's error console.
>
> On Thursday, September 20, 2012 5:45:00 PM UTC-4, Niphlod wrote:
>>
>> nowhere if the output isn't redirected to some file. Console means
>> "standard output + standard error", you see it only if you're running on
>> terminal (unix, mac) or Dos prompt (Windows). That's why usually
>> "production" apps log something directly to a file or to a database.
>>
>> On Thursday, September 20, 2012 11:20:10 PM UTC+2, monotasker wrote:
>>>
>>> Ok, this reveals the depth of my ignorance. The logging.example.conf
>>> file is set up to output logs to "console." What is that? If I'm trying to
>>> log things running on a remote server, where do I access this "console"?
>>>
>>> Thanks.
>>>
>>
--