[Tutor] Logging with different formats

Ertl, John John.Ertl at fnmoc.navy.mil
Tue May 4 16:55:25 EDT 2004


All,

I am looking at using logging for a program that I am working on but I
cannot figure out how to have logging use different formats for different
types of 
Events.

For instance the output needs to look like:

<APPLOG>
<APPSTART name="tc_tcw.job: time="20040122125821" userid="opsu"
platform="aos" devlevel="ops">
<APPEVENT name="tc_tcw.job" event="decode" time="20040122125856"
platform="aos" devlevel="ops" productid="wp012004.tcw" msgtype="I"
msglevel="good data" msg="decoded tcw file for storm 01W 2004012212Z valid
time">
<APPEVENT name="tc_tcw.job" event="decode" time="20040122130201"
platform="aos" devlevel="ops" 
productid="sh032004.tcw" msgtype="C" msglevel="bad data" msg="decode tcw
file for storm 03S 2004012212Z valid time">
<APPERR name=tc_tcw.job" subprogram="tc_deco chkdirspd.f90"
time="20040122130201" platform="aos" devlevel="ops" msgtype="C"
msg="direction and speed error in storm  03S 2004012212Z warning summary --
METTECH must correct" endtime="0">
<APPEVENT name="tc_tcw.job" event="trigger windp.job" time="20040122130059"
platform="aos" devlevel="ops" msgtype="I" msg="calling process to create
WindP/StrikeP messages">
<APPDONE name="tc_tcw.job" time="20040122130108" userid="opsu"
platform="aos" msgtype="O" msg="Completed OK" status="0" cpuuse="10">
</APPLOG>

As you can see there is a lot of info that needs to be in each TAG but most
of it is the same for each "type".  I cannot see how to easily switch the
formatter to look like APPEVENT, APPERR or one of the others that I need to
log.  I am new to OO programming but I was originally logging this with a
class that I created and just called different functions and used the print
statement...this worked but I think using logging would be better if I could
figure it out.

Any examples or advice is appreciated,  Thanks.  

John Ertl 





More information about the Tutor mailing list