Event log is a great resource for tracking run time issues on fly. However, most of the event log viewer available are GUI applications. In some situations, a web based GUI log viewer will be a better and convenient tool, especially when people start paying more and more attentions to clouding their services and products.
This note records the process of finding a good open source web based log viewer for logs generated by e.g. log4j.
1. Direct logs to Database such as MongoDb using event log database appender. In my application, I used a mongoDb appender “org.log4mongo.MongoDbAppender” and a web based MongoDb Management tool “mVierer”. This combination satisfied my basic need. However, if I need advanced analytic capabilities, customized MongoDB query logic and dedicated web GUI is still needed.
2. “Log4Web” is a tool developed by Launch Software. This web application reads log4j generated xml formatted log files (with .log4j extension) and presents on the web.
Log4Web is provided in .war format and can easily be installed in any web server containers such as Apache Tomcat. After installation, the log file reading page is
http://:/Log4Web/
to make this whole thing work, the following are needed
2.1. make the application file log appender to log in xml format (see the following exampe)
<appender name="xmlAppender-rsas" class="org.apache.log4j.RollingFileAppender">
<param name="Threshold" value="INFO" />
<param name="append" value="true"/>
<param name="File" value="/var/log/xxx/fw_rsas.log4j"/>
<param name="MaxFileSize" value="10MB"/>
<param name="MaxBackupIndex" value="10"/>
<layout class="org.apache.log4j.xml.XMLLayout">
<param name="LocationInfo" value="true"/>
</layout>
</appender>
2.2. config Log4Web log file
2.2.1 import the .war file into eclipse
File –> import
select “Web/WARfile” in templates list
and then follow the steps
2.2.2 edit the configuration file
edit the web.xml file contained in Log4Web.war (Log4Web/WebContent/WEB-INF/lib/web.xml), and add the specification of the log file directory, and repackage the .war.
2.2.3 repackage the .war
Right click “Log4Web” project, Export –> WAR file
2.3. deploy the new .war file into web server container.
Everything looks working except the web page have a limit of the log data not late than 2010. I’ll find out how to fix this later.