问题
I am using slf4j + logback for logging. I am looking for a good event log viewer (like Apache Chainsaw). Logback website mentions Lilith. The lilith website is not only ugly (says so on website homepage!) but also lacks any documentation whatsoever.
Are there any tutorials on how to get started with Lilith (may be I am finding it difficult to grasp as I have never used Apache Chainsaw, would it help if I read a tutorial on Chainsaw?).
Also, are there any alternative log viewers for logback with better documentation?
回答1:
I'm the developer of Lilith and the creator of the ugly homepage. ;)
I know that it is lacking documentation and I'm not very good at "selling" my application.
Please take a look at the readme over at https://github.com/huxi/lilith
I tried to describe the most common use-cases of Lilith in that file. There is also some help contained in Lilith itself.
Ekkehard Gentz has written a small tutorial about Lilith: http://ekkescorner.wordpress.com/2009/09/05/osgi-logging-part-8-viewing-log-events-lilith/
Hope that helps.
回答2:
Basically, create a file logback.xml
with the following content
<configuration>
<appender name="LogbackClassic" class="ch.qos.logback.classic.net.SocketAppender">
<RemoteHost>localhost</RemoteHost>
<Port>4560</Port>
<ReconnectionDelay>170</ReconnectionDelay>
<IncludeCallerData>true</IncludeCallerData>
</appender>
<root level="INFO">
<appender-ref ref="LogbackClassic"/>
</root>
</configuration>
Make you can pass in this configuration using a system property logback.configurationFile
, so you might want to do something like this:
final String LOGBACK = "logback.configurationFile";
if(System.getProperty(LOGBACK) == null)
System.setProperty(LOGBACK, "file:logback.xml");
That should be enough, once your application start's logging a window will open in Lilith and show you the logs.
回答3:
Chainsaw can read any regular text log file, including those created by slf4j and logback.
Try the latest developer snapshot of Chainsaw - it has a ton of new features which make it easy to colorize, search and filter events. You can also annotate any log entry (by adding a comment in the 'marker' field), export the log file from Chainsaw and email the log file to someone else, who can see your log and the comments you added to log entries in-place, exactly as you saw the log when you exported it from Chainsaw.
Chainsaw's initial configuration dialog makes it easy to help you start tailing a log file - you can specify the log file you want to process, and then the format of the file, and Chainsaw will start tailing the file.
If you were using log4j and a fileappender, you could use that log4j.properties file (or log4j.xml) to get Chainsaw to start tailing the log file defined from the fileappender entries in the config file.
Chainsaw also has a tutorial, built in to the UI, available from the help menu or the Welcome tab.
Right click on most anything to see what you can do an explore the menus. Or post a message to the log4j-users mailing list to get questions answered.
The latest developer snapshot of Chainsaw is available here: http://people.apache.org/~sdeboy
来源:https://stackoverflow.com/questions/11643872/any-good-tutorials-on-lilith-log-viewer-for-logback