You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Subhrajyoti Moitra <sm...@sapient.com> on 2005/05/29 04:46:48 UTC

Parsing Log4J files.

Hi,

 

Given :

 

I am using Log4J along with AspectJ for logging.

The Conversion pattern I am using in log4j is as follows. (This is just
an example)

%d{ABSOLUTE} %5p %X{JSESSIONID} %c{1}:%L - %m%n

 

In a Servlet filter I am setting the JSESSIONID in a MDC.

 

So finally my logs are something like this:

 

<snip>

19:45:00,745  WARN 16CB951ED8ADBB1262AC21944AD94AF8 trace:76 - Exiting
[com.xx.ac.xxx.connection.CXXXXConnectionManager.getActiveSize]

19:45:00,745  WARN 16CB951ED8ADBB1262AC21944AD94AF8 trace:66 - Entering
[com.xx.ac.xxx.connection.CXXXXConnectionManager.getCacheSize]

19:45:00,745  WARN 16CB951ED8ADBB1262AC21944AD94AF8 trace:76 - Exiting
[com.xx.ac.xxx.connection.CXXXXConnectionManager.getCacheSize]

19:45:00,745  WARN 16CB951ED8ADBB1262AC21944AD94AF8 trace:76 - Exiting
[com.xx.ac.xxx.connection.CXXXXConnectionManager.getConnection]

19:45:00,745  WARN 5DAD9A3F70E9FE171F41CFF12CFE480B trace:76 - Exiting
[com.xx.ac.xxx.academy.AcademyQry.getNextAcademyToInitialize]

19:45:00,839  WARN 16CB951ED8ADBB1262AC21944AD94AF8 trace:76 - Exiting
[com.xx.ac.xxx.connection.CXXXXConnectionManager.getConnection]

19:45:00,839  WARN 5DAD9A3F70E9FE171F41CFF12CFE480B trace:76 - Exiting
[com.xx.ac.xxx.academy.Academy.getNextAcademyToInitialize]

19:45:00,839  WARN 16CB951ED8ADBB1262AC21944AD94AF8 trace:76 - Exiting
[com.xx.ac.xxx.connection.CXXXXDataSourceManager.getConnection]

19:45:00,839  WARN 5DAD9A3F70E9FE171F41CFF12CFE480B trace:59 -
Initializing
[com.xx.ac.xxx.presentation.servlet.event.CXXXXForwardResolution.<init>]

19:45:00,855  WARN 16CB951ED8ADBB1262AC21944AD94AF8 trace:76 - Exiting
[com.xx.ac.xxx.sql.CXXXXSqlStatementFactory.createPreparedStatement]

19:45:00,855  WARN 5DAD9A3F70E9FE171F41CFF12CFE480B trace:66 - Entering
[com.xx.ac.xxx.presentation.servlet.state.CXXXXStateManager.put]

19:45:00,855  WARN 5DAD9A3F70E9FE171F41CFF12CFE480B trace:76 - Exiting
[com.xx.ac.xxx.presentation.servlet.state.CXXXXStateManager.put]

 

<snip>

 

 

Each log statement has the session id along with it.

 

 

Problem:

 

I want a log viewer. A graph plotted for each SET of session ids. So the
user will enter some thing like "16CB951ED8ADBB1262AC21944AD94AF8" as
input(to start with). My viewer will parse all the entries in the log
file for the particular sessionid entered by the user. It will then plot
a graph with the names of methods/classes. So basically the idea is to
get a picture of all the method calls that got executed. The viewer need
not process log files in real time. 

So I am looking for some API for parsing Log4J logs. I know of chainsaw.
But I don't know if this can parse existing log files and give some sort
of plot of all the method calls.

 

Possible Solution: 

 

Write a perl script to parse the log files. Feed this data in some graph
plotter. Probably use some cross platform GUI toolkit for some
flamboyancy (wxWindows/Swing). This is required to be running on
Linux/Win32 systems. I am not very accommodating with Swing. But if it
can fix the problem, I will be more than happy.

Alternatively I can use Perl:GD wrapper to generate png images on the
fly and display it on a browser. This will be very good.

Please suggest something on this regard. 

 

 

 

 

 

Thanks a lot in advance.

 

Subhro

 


RE: Parsing Log4J files.

Posted by Aron Bock <ar...@hotmail.com>.
>Write a perl script to parse the log files. Feed this data in some graph
>plotter. Probably use some cross platform GUI toolkit for some
>flamboyancy (wxWindows/Swing). This is required to be running on
>Linux/Win32 systems. I am not very accommodating with Swing. But if it
>can fix the problem, I will be more than happy.
>
>Alternatively I can use Perl:GD wrapper to generate png images on the
>fly and display it on a browser. This will be very good.

If I expected to do a lot of log analysis I'd opt to either log to a 
database, or to load file logs into a database before looking for trends, 
usage patterns, etc.  Then build a web interface.

Regards,

--A

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org