Community Mobile Android iOS Windows Phone System. NET Java programming design patterns Methods Tools Version Operating system Linux / Unix Windows OS X Hardware Everyday Humor
In the project I'm working is a need to introduce peter justesen errors of a specific class for some users. These errors are logged already a loggingramverk (hidden behind slf4j), but unfortunately drown them in the crowd of other log sages.
That for desa users filter out only the described class of messages (ie, a classic log message peter justesen presentation)'s technically easy but not desirable; instead, it would be good if these errors were presented visually integrated peter justesen into the application.
log4j-viewer Only Built for log4j Only Built for log4j v1 Undecided quality (Closes not of log4j-viewerns own logs to get feedback and SWT thread hangs) the preferences that log4j-viewer can select the columns are not documented, so you have to look a bit in the source code to derive / reverse engineering the Eclipse Public License peter justesen
Logback-beagle Only Built for logback Eclipse peter justesen Public License So paragraphs 1 and 2's boring for log4j-viewer. If we in the application has managed to hide behind log4j slf4j, then we do not expose the log4j again (indirect exposure that we face due to log4j-viewer). Similarly, the point 1 to logback-beagles peter justesen disadvantage, but right now it feels logback peter justesen right, and this is therefore not as serious.
2nd Add log4j-viewer to your application configuration. In my example, I made it through and add to the view of my perspective through plugin.xml: <extension point="org.eclipse.ui.perspectiveExtensions"> <perspectiveExtension targetID="*"> <view minimized peter justesen = "false" relative = "org.eclipse.ui.editorss" relationship = "left" peter justesen id = "com.example.rcpapp.view"> </ view> <view minimized = "false" id = "log4jviewer.ui.views.LogView" peter justesen relationship = "bottom" relative = "com.example.rcpapp.view" visible = "true"> </ view> peter justesen </ extension perspective> </ extension>
3rd Define specific logger (com.example.rcpapp.Topic-A) and SocketAppender (log4j.appender.Log4jViewer) and ensure that only the specific logger who communicated with appendern (that was what was the main purpose of the task): # Set root logger level to DEBUG and its only appender to A1. log4j.rootLogger = DEBUG, A1 # A1 is set to be a ConsoleAppender. log4j.appender.A1 = org.apache.log4j.ConsoleAppender # A1 uses Pattern Layout. log4j.appender.A1.layout = org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern =%-4r [% t]%-5p% c% x -% m% n = log4j.appender.Log4jViewer org.apache.log4j.net.SocketAppender log4j.appender.Log4jViewer.remoteHost = localhost log4j.appender.Log4jViewer.port = 4445 log4j.appender.Log4jViewer.locationInfo = true log4j.logger.com.example.rcpapp.Topic-A = DEBUG, Log4jViewer log4j.additivity.com.example.rcpapp.Topic-A = false
4. Use the default logger for standard log and instead use specific logger for things that should reach log4j-viewer: peter justesen import org.apache.log4j.LogManager; import org.apache.log4j.Logger; private static Logger lugger Opica = LogManager.getLogger ("com. example.rcpapp.Topic-A "); loggerTopicA.error (" An error "); loggerTopicA.warn (" A warning ");
2nd Add logback-beagle to your application configuration: <extension point="org.eclipse.ui.perspectiveExtensions"> <perspective extension TargetId = "* peter justesen & q
No comments:
Post a Comment