'quickness' depends on how fast your log is filling.
Log size matters too.

I usually offer two views of my logs.
One is a full/slow/not refreshing view of the entire file.
The other is a partial/fast/auto-refreshing view of the last 20-50
lines (via a tail command).

For specific "realtime" needs, I have once used a message queue
(orbited) to broadcast log messages to web clients in real-time.
But this is quite over-sophisticated !!

Storing log in database sounds like bad idea :
Log size will decrease performance of all operations (even if it is
not log related).
Logging module have rotating file feature to avoid filling your disk
with ever-growing logs.
You will never lock your database with logging to files.


2011/1/20 mart <[email protected]>:
> yeah, its all python... Are you able to refresh quickly enough (like
> with large file processing) ? I log everything to a few tables, so, I
> should be able to use what you're saying but by querying the DB
> instead of open/read/close a file repeatedly?
>
> This a great idea! Thanks :)
>
> On Jan 20, 4:42 pm, Philippe ENTZMANN <[email protected]>
> wrote:
>> Via the Python logging module.
>> This is a code snippet I use to set a log file (if your process is in 
>> Python) :
>>
>>     log = logging.getLogger("checkmail")
>>     log.setLevel(logging.DEBUG)
>>     fh = logging.FileHandler("../logs/checkmail.log")
>>     fh.setLevel(logging.DEBUG)
>>     # create formatter and add it to the handlers
>>     formatter = logging.Formatter("%(asctime)s - %(name)s -
>> %(levelname)s - %(message)s")
>>     fh.setFormatter(formatter)
>>     # add the handlers to logger
>>     log.addHandler(fh)
>>
>> Your controller will do :
>>      return 
>> dict(data=open("/application/myapp/logs/checkmail.log").readlines())
>>
>> If your process is not a Python program, you can redirect output to a
>> file via a shell redirection (>) or with the subprocess module.
>>
>> 2011/1/20 mart <[email protected]>:
>>
>>
>>
>>
>>
>>
>>
>> > Hi,
>>
>> > Does anyone have a quick ad dirty trick to display process output to a
>> > web age (a panel or something)?
>>
>> > Thanks,
>> > Mart :)
>

Reply via email to