Re: Custom Log Messages that get forwarded to a database (JPA or JDBC)
Christian, As it turns out, Log4j2 has a JDBC appender, which can be configured to suit your needs. You can find more information out about it here: https://logging.apache.org/log4j/2.x/manual/appenders.html#JDBCAppender I've personally not run into a use case where a database-backed appender was an ideal solution, but it exists as an option. ~Jason On Fri, Nov 22, 2013 at 6:13 PM, Christian Schneider < cschneiderpub...@gmail.com> wrote: > Hi, our application runs on several nodes and sometimes there are some long > running processes. > During this processes we collect logs of different types. > For example: > * Current Env. information (like IP-Address, OS Name, ...) > * Urls and their statuscodes, > * Erros (Stacktraces) thrown during the process > * Some logging of execution times of sub tasks > * Some counts of different events > * Information about loaded plugins from the classpath > and stuff like that. > > At the end we need to browse through this data (e.g. with a WebUI from a > database) to react on the things that may happened during the process. > > Because the types so different, it would be nice to have an own logging > facade. Something like this: > > interface ProcessLoggingFacade { > > public void info(String ipAddress, OS osType, ...); > > public void info(Url url, int statuscode); > > public void error(String msg, Throwable e); > // > } > > The impl. of this facade should parse all calls and store them into > different tables of a remote database. > > Do you think this is a good approach and it is possible with log4j? > > Thanks, > > Best Regards, > Christian. >
Re: Log4j2 Tag Library + Tomcat 7
That definitely took care of it. Thank you for pointing me in the right direction. On Thu, Aug 22, 2013 at 4:04 PM, Nick Williams < nicho...@nicholaswilliams.net> wrote: > Tomcat 7 introduced a feature to skip the scanning of certain JARs to > improve JSP engine initialization. This feature including a default setting > to skip many popular JARs that were known not to contain TLDs or SCIs. > Unfortunately, this included a log4j*.jar default exclusion, meaning the > Log4j JARs are not scanned for TLDs. > > See the Tomcat bug/feature request > https://issues.apache.org/bugzilla/show_bug.cgi?id=54770 > > This is fixed in Tomcat 7.0.43 and Tomcat 8. Tomcat no longer skips the > Log4j JARs when scanning for TLDs and SCIs. 7.0.43 has not been released > yet. It is being held up by a project to port the Java EE 7/JSR-356 > WebSocket implementation from Tomcat 8 to Tomcat 7. The expected release is > sometime in the middle of September, hopefully earlier. > > For now you can edit your catalina.properties file and take the log4j*.jar > exclusion out of the jarsToSkip property. > > I need to improve the documentation surrounding this. That's on my > calendar. > > Nick > > On Aug 22, 2013, at 4:48 PM, Jason B wrote: > > > All, > > > > I'm running into a bit of weirdness when using Tomcat 7 and Log4j2's Tag > > Library. I have a JSP set up with the following property: > > > > <%@ taglib uri="http://logging.apache.org/log4j/tld/log"; prefix="log" %> > > > > ...which works just fine with Tomcat 6, whenever I hit an error > condition. > > > > However, if I move to Tomcat 7, I get the following exception: > > > > > > org.apache.jasper.JasperException: The absolute uri: > > http://logging.apache.org/log4j/tld/log cannot be resolved in either > > web.xml or the jar files deployed with this application > > > > If I move the .tld into my META-INF folder, it works fine as well. > > > > Is this some sort of issue between Tomcat 6 and Tomcat 7 that hasn't been > > explored yet, or am I missing a configuration step? > >
Log4j2 Tag Library + Tomcat 7
All, I'm running into a bit of weirdness when using Tomcat 7 and Log4j2's Tag Library. I have a JSP set up with the following property: <%@ taglib uri="http://logging.apache.org/log4j/tld/log"; prefix="log" %> ...which works just fine with Tomcat 6, whenever I hit an error condition. However, if I move to Tomcat 7, I get the following exception: org.apache.jasper.JasperException: The absolute uri: http://logging.apache.org/log4j/tld/log cannot be resolved in either web.xml or the jar files deployed with this application If I move the .tld into my META-INF folder, it works fine as well. Is this some sort of issue between Tomcat 6 and Tomcat 7 that hasn't been explored yet, or am I missing a configuration step?
Convenient way to append Class Name in Syslog Appender
Is there a convenient way to retrieve the class name in the Syslog appender? If not, I could engineer my own solution - I was unsure if this was already captured in another bug report or feature request. ~Jason
Re: Convient way to specify Log4J2 configuration outside of webapp?
Ran into another interesting use case: Suppose I have two applications that run in the same Tomcat instance. If I use the -Dlog4j.configurationFile property, would I be able to specify individual log configurations for those applications? On Mon, May 13, 2013 at 12:13 PM, Jason B wrote: > I believe that solves that problem. Thank you very much for your reply! > > - Jason Black > > > On Mon, May 13, 2013 at 10:44 AM, Remko Popma wrote: > >> By default Log4j looks for log4j2.xml in the classpath, but you can also >> specify system property >> -Dlog4j.configurationFile=path/to/log4j2.xml >> >> or even in your code: >> >> System.setProperty(XMLConfigurationFactory.CONFIGURATION_FILE_PROPERTY, >> "path/to/log4j2.xml"); >> >> >> >> >> From: Jason B >> To: log4j-user@logging.apache.org >> Sent: Tuesday, May 14, 2013 1:32 AM >> Subject: Convient way to specify Log4J2 configuration outside of webapp? >> >> >> Hello, >> >> I'm wondering if there is a convenient way to configure Log4J2 logging >> without having it inside of our resources directory. I don't want to use >> symbolic links, as that has the potential of introducing security holes >> into our platform. >> >> We're looking into other options such as specifying file locations, but >> the >> documentation is incomplete or does not apply to our unique solution. >> >> Could some light be shed on this? >> >> Thanks, >> >> Jason Black >> > >
Re: Custom Syslog Format: Appending Exceptions?
I find this interesting...you had to go back a few levels to implement this sort of custom behavior. I'd love to see your patches, since I'm curious if this can be incorporated into the SyslogAppender as opposed to going one or two levels above it. - Jason Black On Tue, May 14, 2013 at 2:10 AM, Tomek Kaczynski wrote: > Hi, > >In my case I created a SyslogWrapperLayout which can wrap any other > layout, so I put PatternLayout inside SyslogWrapperLayout. As far as I see > that's the only way to get cusomizeable Layout for syslog. Ah, and one more > thing, I don't use SyslogAppender, but a simple SocketAppender with > SyslogWrapperLayout, it works great, > >Obviously that's not a standard way, but that's how log4j2 should work > ;-) > > > > Tomek > > > On Mon, May 13, 2013 at 8:38 PM, Jason B > wrote: > > > Looking around at the Syslog support, and I noticed that exceptions > aren't > > being sent across the wire. I understand that there may be some limit to > > how much data we're sending across with Syslog via TCP, but I was curious > > if there was any custom support for formatters with exceptions. > > > > I came across this old JIRA for that support: > > > > https://issues.apache.org/jira/browse/LOG4J2-136 > > > > ... and looking into RFC5424Layout, I see that it could be added, but I'm > > not sure if our setup is configured properly to make use of it. > > > > - Jason Black > > >
Burst Filter - Use to limit messages sent over a specific period?
I'm attempting to leverage a burst filter in my application. I wish to log errors and send e-mails any time we log an error. The main thing is, I don't want to send more than a few e-mails in a given time period (say, one per event per fifteen minutes), to avoid overwhelming my inbox with these error events. Burst Filter seems appropriate for this role, but the documentation is lacking. For instance: - If I want a filter to accept only those events that happen after the threshold, but "rest" for that fifteen minute period of time, how would I accomplish this? The configuration is less than intuitive here. - What is the role of ? It's not mentioned anywhere on the site, and only by digging in the source could I actually determine what it's supposed to be doing. It's also listed in every example for filters on the site. Thanks for clearing up any confusion. - Jason Black
Custom Syslog Format: Appending Exceptions?
Looking around at the Syslog support, and I noticed that exceptions aren't being sent across the wire. I understand that there may be some limit to how much data we're sending across with Syslog via TCP, but I was curious if there was any custom support for formatters with exceptions. I came across this old JIRA for that support: https://issues.apache.org/jira/browse/LOG4J2-136 ... and looking into RFC5424Layout, I see that it could be added, but I'm not sure if our setup is configured properly to make use of it. - Jason Black
Re: Convient way to specify Log4J2 configuration outside of webapp?
I believe that solves that problem. Thank you very much for your reply! - Jason Black On Mon, May 13, 2013 at 10:44 AM, Remko Popma wrote: > By default Log4j looks for log4j2.xml in the classpath, but you can also > specify system property > -Dlog4j.configurationFile=path/to/log4j2.xml > > or even in your code: > > System.setProperty(XMLConfigurationFactory.CONFIGURATION_FILE_PROPERTY, > "path/to/log4j2.xml"); > > > > ____ > From: Jason B > To: log4j-user@logging.apache.org > Sent: Tuesday, May 14, 2013 1:32 AM > Subject: Convient way to specify Log4J2 configuration outside of webapp? > > > Hello, > > I'm wondering if there is a convenient way to configure Log4J2 logging > without having it inside of our resources directory. I don't want to use > symbolic links, as that has the potential of introducing security holes > into our platform. > > We're looking into other options such as specifying file locations, but the > documentation is incomplete or does not apply to our unique solution. > > Could some light be shed on this? > > Thanks, > > Jason Black >
Convient way to specify Log4J2 configuration outside of webapp?
Hello, I'm wondering if there is a convenient way to configure Log4J2 logging without having it inside of our resources directory. I don't want to use symbolic links, as that has the potential of introducing security holes into our platform. We're looking into other options such as specifying file locations, but the documentation is incomplete or does not apply to our unique solution. Could some light be shed on this? Thanks, Jason Black