the .ini file in use has that exact logging configuration already.    
paster with the "--daemon" option redirects stdout and stderr to  
paster.log.

Here is the source code from PasteScript's "script.py" which does this:

  if getattr(self.options, 'daemon', False):
             if not self.options.pid_file:
                 self.options.pid_file = 'paster.pid'
             if not self.options.log_file:
                 self.options.log_file = 'paster.log'

and later....

         if self.options.log_file:
             stdout_log = LazyWriter(self.options.log_file, 'a')
             sys.stdout = stdout_log
             sys.stderr = stdout_log
             logging.basicConfig(stream=stdout_log)

There's no conditional behavior within --daemon mode or consultation  
of existing log configurations ("logging" in fact does not provide  
this capability, as we would love to have it in SQLA).  If --daemon is  
set, stdout/stderr are going to a plain file.

LazyWriter only accepts a string filename (uses open(name, 'w') on it).

So I could just change my .ini file to entirely move logging  
elsewhere, such as the RotatingFileHandler, but I was hoping for a  
single point of configuration that catches everything, exceptions,  
print statements, etc., and is immediately understandable by any  
sysadmin.


On Jul 23, 2008, at 1:34 PM, Gary Bernhardt wrote:

> Paste will automatically interpret your ini file as a logging module
> config file if the "loggers" key is present. See the "Basic Logging
> Configuration" section at
> <http://wiki.pylonshq.com/display/pylonsdocs/Logging>. The example in
> that section sends all logging to stderr, which seems to be what you
> want, modulo stderr. Last I checked there wasn't any mention of this
> in the Paste docs, but I may have just overlooked it.
>
> On Wed, Jul 23, 2008 at 10:08 AM, Michael Bayer
> <[EMAIL PROTECTED]> wrote:
>> In this case the executable in question is "rotatelogs".   Two ways
>> this could be achieved would be:
>>
>> a. if paster supported a "stdout" option for logging.  Currently if
>> you dont specify a --log-file option, it goes straight to  
>> "paster.log".
>>
>> b. if the --log-file option supported pipes, such as:
>>
>>       paster serve --daemon --log-file "| rotatelogs ./logs/ 
>> mylog.txt 86400"
>>
>> c. im missing something completely obvious ?   (very common)
>>
>> _______________________________________________
>> Paste-users mailing list
>> [email protected]
>> http://webwareforpython.org/cgi-bin/mailman/listinfo/paste-users
>>
>
>
>
> -- 
> Gary
> http://blog.extracheese.org


_______________________________________________
Paste-users mailing list
[email protected]
http://webwareforpython.org/cgi-bin/mailman/listinfo/paste-users

Reply via email to