Vigilog can read log files written in XML format. Below are some examples on how to configure different log systems so they write out files that can be read by Vigilog.
Put a file called log4j.properties on your classpath containing something like this:
# Set root logger level to DEBUG and its only appender to A1. log4j.rootLogger=DEBUG, A1 # A1 is list to be a RollingFileAppender. log4j.appender.A1=org.apache.log4j.RollingFileAppender log4j.appender.A1.File=myapplicationlog.xml # Use files of 1 MB log4j.appender.A1.MaxFileSize=1000KB # Keep 3 backup files log4j.appender.A1.MaxBackupIndex=3 # A1 uses PatternLayout. log4j.appender.A1.layout=org.apache.log4j.xml.XMLLayout
For more information, check out the Apache Log4j website.
Vigilog can also parse plain text files, however there some drawbacks:
Put a file called log4j.properties on your classpath containing something like this:
# Set root logger level to DEBUG and its only appender to A1. log4j.rootLogger=DEBUG, A1 # A1 is list to be a RollingFileAppender. log4j.appender.A1=org.apache.log4j.RollingFileAppender log4j.appender.A1.File=myapplicationlog.log # Use files of 1 MB log4j.appender.A1.MaxFileSize=1000KB # Keep 3 backup files log4j.appender.A1.MaxBackupIndex=3 # A1 uses PatternLayout. log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=%d{DATE} [%t] %-5p %c{2} - %m%n
For more information, check out the Apache Log4j website.
Create a properties file (e.g. mylogging.properties) with contents like this:
# "handlers" specifies a comma separated list of log Handler # classes. These handlers will be installed during VM startup. # Note that these classes must be on the system classpath. handlers= java.util.logging.FileHandler # Default global logging level. # This specifies which kinds of events are logged across # all loggers. For any given facility this global level # can be overriden by a facility specific level # Note that the ConsoleHandler also has a separate level # setting to limit messages printed to the console. .level= INFO # default file output is in user's home directory. java.util.logging.FileHandler.pattern = myapplication%u.log java.util.logging.FileHandler.limit = 50000 java.util.logging.FileHandler.count = 1 java.util.logging.FileHandler.formatter = java.util.logging.XMLFormatter
Start your application with java -Djava.util.logging.config.file=mylogging.properties Main.
For more information, check out the java.util.logging website.
When using Jakarta commons logging, you need to configure the underlaying logging system to be log4j or Java util logging.
Logback is intended as a successor to the popular log4j project. It has currently no XML output files. You can let Vigilog parse the text files by converting your pattern layout to match the conversion words of log4j. E.g. use c in stead of logger. See http://logback.qos.ch/manual/layouts.html for more info.