Log settings in aspire

satya - Sat May 12 2012 08:38:10 GMT-0400 (Eastern Daylight Time)

I kind of know what they are when I am developing

But promptly forget the next time around. Let me see if I can document as of now. I have changed the log behavior a good bit in the last release. It is not perfect but workable.

satya - Sat May 12 2012 08:45:52 GMT-0400 (Eastern Daylight Time)

Let me start with what I had before in the settings file


Logging.logfile=aspire:\\log\\akc.log
Logging.msgLevel = 0
Logging.trace=yes
Logging.excludeFilters=vectorMetadata:,dbrs:,

satya - Sat May 12 2012 08:47:17 GMT-0400 (Eastern Daylight Time)

Most of the logic for logging decisions is in CLog2.java

Most of the logic for logging decisions is in CLog2.java

satya - Sat May 12 2012 08:50:41 GMT-0400 (Eastern Daylight Time)

Let me tackle the first one I am confused about: trace


yes
no

the values can be 'yes' or 'no'. this is a misnomer. This only applies to see if one needs to log the "exception" trace. Now that I think about it, there is no reason not to enable it in most if not all cases.

satya - Sat May 12 2012 09:03:13 GMT-0400 (Eastern Daylight Time)

Now to the msgLevel


public boolean isItNecessaryToLog(int logLevel)
   {
      return (logLevel >= this.m_msgLevel);
   }

satya - Sat May 12 2012 09:04:41 GMT-0400 (Eastern Daylight Time)

Here are some constants


public static final String LOG_SECURITY_S = "Security";
    public static final String LOG_INFO_S = "Info";
    public static final String LOG_ERROR_S = "Error";
    public static final String LOG_WARN_S = "Warning";
    public static final String LOG_CRITICAL_S = "Fatal";

    public static final int LOG_SECURITY = 0;
    public static final int LOG_INFO = 1;
    public static final int LOG_WARN = 2;
    public static final int LOG_ERROR = 3;
    public static final int LOG_CRITICAL = 4;

satya - Sat May 12 2012 09:06:08 GMT-0400 (Eastern Daylight Time)

if I say msglevel as 2 then log warnings and above


warn
error
critical

satya - Sat May 12 2012 09:10:13 GMT-0400 (Eastern Daylight Time)

Only log those messages whose message level is equal or higher

Only log those messages whose message level is equal or higher

satya - Sat May 12 2012 09:10:33 GMT-0400 (Eastern Daylight Time)

so it appears a value of 2 or 3 is better in production leaning on 3

so it appears a value of 2 or 3 is better in production leaning on 3

satya - Sat May 12 2012 09:14:42 GMT-0400 (Eastern Daylight Time)

the filters


excludeFilters
selectiveFilters

satya - Sat May 12 2012 09:15:29 GMT-0400 (Eastern Daylight Time)

Both are comma separated strings

If the log message starts with these strings then either exclude them from the log or include them in the log.

satya - Sat May 12 2012 09:19:13 GMT-0400 (Eastern Daylight Time)

the logic for these filters are

if the message level of the message is high enough (worse consequence) then first see if this message is excluded. don't print it if it is excluded. then don't print it either if it is not selected.

Importantly filters take affect only after the message levels are taken into account.

satya - Sat May 12 2012 09:21:36 GMT-0400 (Eastern Daylight Time)

So a good production setting is


Logging.logfile=aspire:\\log\\akc.log
#Print only errors and critical elements
Logging.msgLevel = 3
Logging.trace=no

satya - Sat May 12 2012 09:27:08 GMT-0400 (Eastern Daylight Time)

I think!!!

I think!!!

satya - Sat May 12 2012 09:27:31 GMT-0400 (Eastern Daylight Time)

well it didn't blew up the server :)

well it didn't blew up the server :)

satya - Sat May 12 2012 12:25:36 GMT-0400 (Eastern Daylight Time)

I have used variable arguments and string formating

I have used variable arguments and string formating to not expand expressions into log methods so that the logging is efficient.