Re: plugins

2015-08-27 Thread Gary Gregory
Note that I wrote such a filter, which is under review ATM here: - https://issues.apache.org/jira/browse/LOG4J2-1106 - https://issues.apache.org/jira/browse/LOG4J2-1105 Gary On Thu, Aug 27, 2015 at 11:51 AM, Nicholas Duane nic...@msn.com wrote: I've got a couple questions regarding plugins

plugins

2015-08-27 Thread Nicholas Duane
I've got a couple questions regarding plugins I'm hoping someone might be able to help me with. I checked the docs and it's still not quite clear. 1. I'm unsure what to set printObject to in my Plugin annotation. From http://logging.apache.org/log4j/2.x/manual/extending.html it says:

RE: plugins

2015-08-27 Thread Nicholas Duane
Based on your previous comments I assume one would show up out-of-the-box at some point. Of course I need mine now so unfortunately I have to write one. Any input on my questions below? Thanks, Nick Date: Thu, 27 Aug 2015 12:20:07 -0700 Subject: Re: plugins From: garydgreg...@gmail.com

RE: plugins

2015-08-27 Thread Nicholas Duane
I don't think the implementation is the issue, though if/when I get my plugin loading and it doesn't work I will certainly try to compare against what Gary wrote. Right now I'm just trying to figure out how to get my plugin loaded. I've got my class file, LevelRangeFilter.java which I

Re: plugins

2015-08-27 Thread Ralph Goers
Can’t you just compare what you wrote to what Gary wrote? If you build your project then it should get packaged in a jar and automatically have the file Log4j uses to quickly load the plugin. Ralph On Aug 27, 2015, at 12:50 PM, Nicholas Duane nic...@msn.com wrote: Based on your previous

Re: plugins

2015-08-27 Thread Remko Popma
Perhaps the simplest thing to do is to add the packages attribute to your log4j2.xml configuration file. Set the value to the package of your custom plugin. Configuration status=trace packages=com.mycomp.pluginpackage ... Remko Sent from my iPhone On 2015/08/28, at 6:42, Nicholas Duane

Re: plugins

2015-08-27 Thread Remko Popma
I think you made a mistake there: your config says Configuration status=trace verbose=true packages=LevelRangeFilter But your code does not have a package declaration at the top. This means it is in the default (nameless) package. Change your code to start with: package

Re: plugins

2015-08-27 Thread Ralph Goers
printObject affects the way plugins are logged when you have status=debug enabled. If you set printObject to true then the Plugin’s toString method will be called to log the Plugin’s “name”. Usually, this is just the SimpleClassName, but if the class name doesn’t match the Plugin name it can

RE: plugins

2015-08-27 Thread Nicholas Duane
Awesome, thanks. I needed a little bit more because of my java noobness, but I was able to figure that out. Looks like I needed the -d on the javac command so that it created the appropriate directory structure for my .class file based on the package name. Then things started working!! Now

Re: redefining existing levels?

2015-08-27 Thread Mikael Ståldal
If some of the logging is business critical, perhaps you should put it in a separate logging context and don't let your users reconfigure that context. Or not use Log4j at all for the business critical logging. On Wed, Aug 26, 2015 at 3:46 AM, Nicholas Duane nic...@msn.com wrote: Yes and no.