[Logo] Enterprise Client Community
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
log file output  XML
Forum Index -> Development
Author Message
moebus

Power User

Joined: 21/11/2007 12:49:18
Messages: 93
Offline

is it possible to add something like session id, or thread name, to each line of the log output, so that each roundtrip can be analyzed correctly.

a minor problem: some lines of the output (..."request to be processed" et. al.) contain a number [...345] which is probably the milliseconds since the last such output, useful to determine the processing time of each request. However this is rather useless with more workload when requests overlap; additionally the calculation of this seems to be rather vulnerable to parallel access.

regards
Manfred
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5520
Offline

Hi,

we already output the thread id...:

Code:
         StringBuffer result = new StringBuffer();
         m_cal.setTimeInMillis(record.getMillis()); 
         result.append(m_cal.get(Calendar.YEAR));
         result.append(":");
         result.append(fv((m_cal.get(Calendar.MONTH)+1)+"",2));
         result.append(":");
         result.append(fv(m_cal.get(Calendar.DAY_OF_MONTH)+"",2));
         result.append(" ");
         result.append(fv(m_cal.get(Calendar.HOUR_OF_DAY)+"",2));
         result.append(":");
         result.append(fv(m_cal.get(Calendar.MINUTE)+"",2));
         result.append(":");
         result.append(fv(m_cal.get(Calendar.SECOND)+"",2));
         result.append(":");
         result.append(fv(m_cal.get(Calendar.MILLISECOND)+"",3));
         result.append(" | ");
         result.append(fs(record.getThreadID()+"",6));
         result.append(" | ");
         result.append(fs(record.getLevel()+"",8));
         result.append(" | ");
         result.append(record.getMessage());
         if (s_outputclassmethod == true)
         {
             result.append(" .......... ");
             result.append(record.getSourceClassName());
             result.append(">");
             result.append(record.getSourceMethodName());
         }
         result.append("\n");
         if (record.getThrown() != null)
         {
             ByteArrayOutputStream baos = new ByteArrayOutputStream();
             PrintWriter pw = new PrintWriter(baos);
             record.getThrown().printStackTrace(pw);
             pw.flush();
             result.append(".......... Stacktrace Info ..........\n");
             result.append(baos.toString());
         }
         return result.toString();
 


Adding the session id is a bigger problem, we would have to update all our logging statements.

If this is a problem: you may write a Filter (servlet filter), that at the very beginning set the thread id to the session id. You may use this filter for testing purposes only (changing the thread id is typically not really "polite"...).

Björn

Björn Müller, CaptainCasa GmbH
moebus

Power User

Joined: 21/11/2007 12:49:18
Messages: 93
Offline

Hi,
might have looked at the standard first, before complaining.

We have recently switched to log4j logging, using your ILogOutput interface mechanism. Then it is of course our duty to ensure that all relevant information is output.

Manfred
 
Forum Index -> Development
Go to:   
Powered by JForum 2.1.6 © JForum Team