Re: Logger Wrapper + Trace API = Issues

2016-09-11 Thread Remko Popma
Thanks! I updated the docs. On Mon, Sep 12, 2016 at 12:01 AM, Juan Fuentes (CISD) < juan.fuentes.c...@gmail.com> wrote: > Sadly no. Maybe a note under the example its enough, hopefully people will > read through. > > NOTE: Under the bash shell on Unix/Mac/Linux you need to escape the $ > characte

Re: Logger Wrapper + Trace API = Issues

2016-09-11 Thread Juan Fuentes (CISD)
Sadly no. Maybe a note under the example its enough, hopefully people will read through. NOTE: Under the bash shell on Unix/Mac/Linux you need to escape the $ character, so the class name should be between single quotes 'org.apache.logging.log4j.core.tools.Generate$ExtendedLogger’. Juan > On

Re: Logger Wrapper + Trace API = Issues

2016-09-11 Thread Remko Popma
On windows, quoting with double quotes works, single quotes does not work. Does this work for you? java -cp log4j-core-2.6.2.jar "org.apache.logging.log4j.core.tools.Generate$ExtendedLogger" com.mycomp.ExtLogger DIAG=350 NOTICE=450 VERBOSE=550 > ExtLogger.java On Sun, Sep 11, 2016 at 10:51 PM, Re

Re: Logger Wrapper + Trace API = Issues

2016-09-11 Thread Remko Popma
Thanks! I'll try this and update the docs. Remko Sent from my iPhone > On 2016/09/11, at 21:37, Juan Fuentes (CISD) > wrote: > > I finally found why it didn’t work, was not finding the internal class > because the $ needs to be escaped under unix, so for MAC/Linux you need to > put the cla

Re: Logger Wrapper + Trace API = Issues

2016-09-11 Thread Juan Fuentes (CISD)
I finally found why it didn’t work, was not finding the internal class because the $ needs to be escaped under unix, so for MAC/Linux you need to put the class name containing $ between quotes, I suppose on windows will work this way too. Would be great to update the docs to reflect this. The

Re: Logger Wrapper + Trace API = Issues

2016-09-11 Thread Remko Popma
FYI Added entry to the FAQ: https://github.com/apache/logging-log4j2/blob/master/src/site/xdoc/faq.xml#L377 On Sunday, 11 September 2016, Remko Popma wrote: > You need to also specify the log levels to generate, but the below both > worked for me: > > %JAVA_HOME%\bin\java -cp classes > org.apac

Re: Logger Wrapper + Trace API = Issues

2016-09-11 Thread Remko Popma
You need to also specify the log levels to generate, but the below both worked for me: %JAVA_HOME%\bin\java -cp classes org.apache.logging.log4j.core.tools.Generate$ExtendedLogger MyLogger DELETEME=333 > MyLogger.java %JAVA_HOME%\bin\java -cp classes org.apache.logging.log4j.core.tools.Generate$

Re: Logger Wrapper + Trace API = Issues

2016-09-11 Thread Juan Fuentes
OS X Yosemite Version 10.10.5 bs-mbpr28:~ juanf$ java -version java version "1.8.0_73" Java(TM) SE Runtime Environment (build 1.8.0_73-b02) Java HotSpot(TM) 64-Bit Server VM (build 25.73-b02, mixed mode) Juan > On 11 Sep 2016, at 09:39, Remko Popma wrote: > > What platform are you using? it us

Re: Logger Wrapper + Trace API = Issues

2016-09-11 Thread Remko Popma
What platform are you using? it used to work for me on windows... On Sun, Sep 11, 2016 at 4:16 PM, Juan Fuentes wrote: > I did copy paste the examples, so those where included. > > java -cp log4j-core-2.6.2.jar > org.apache.logging.log4j.core.tools.Generate$CustomLogger > MyLogger > MyLogger.ja

Re: Logger Wrapper + Trace API = Issues

2016-09-11 Thread Juan Fuentes
I did copy paste the examples, so those where included. java -cp log4j-core-2.6.2.jar org.apache.logging.log4j.core.tools.Generate$CustomLogger MyLogger > MyLogger.java I tried having MyLogger in both a package and base package and also outputting the source to console or a file. Juan > On 1

Re: Logger Wrapper + Trace API = Issues

2016-09-11 Thread Remko Popma
You need to run either Generate$ExtendedLogger or Generate$CustomLogger. Generate does not have a main method. On Sun, Sep 11, 2016 at 4:10 PM, Juan Fuentes wrote: > As I side note, I tried to use that tool this morning to see the code that > generates, and it fails to me using the examples. > >

Re: Logger Wrapper + Trace API = Issues

2016-09-11 Thread Juan Fuentes
As I side note, I tried to use that tool this morning to see the code that generates, and it fails to me using the examples. Error: Main method not found in class org.apache.logging.log4j.core.tools.Generate, please define the main method as: public static void main(String[] args) or a JavaFX

Re: Logger Wrapper + Trace API = Issues

2016-09-10 Thread Remko Popma
The focus of that logger wrapper generator is on the convenience methods to generate for a new log level, that is why the tools is documented under custom levels. This still makes sense to me, but I've seen this question several times now so you are certainly not the only one who didn't find the d

Re: Logger Wrapper + Trace API = Issues

2016-09-10 Thread Ralph Goers
I should have looked at your link first. It seems rather odd to find custom logger documentation under custom levels, and I didn’t see it in the table of contents - probably because I didn’t think to click on that. Ralph > On Sep 10, 2016, at 11:39 PM, Ralph Goers wrote: > > Do we have docum

Re: Logger Wrapper + Trace API = Issues

2016-09-10 Thread Ralph Goers
Do we have documentation on making custom Loggers? Ralph > On Sep 10, 2016, at 5:09 PM, Remko Popma wrote: > > The easier way is to use the wrapper generator tool included in log4j. The > tool is intended to be used with custom log levels and is documented here: > https://logging.apache.org/l

Re: Logger Wrapper + Trace API = Issues

2016-09-10 Thread Remko Popma
The easier way is to use the wrapper generator tool included in log4j. The tool is intended to be used with custom log levels and is documented here: https://logging.apache.org/log4j/2.x/manual/customloglevels.html#AddingOrReplacingLevels I should add this question to the faq page, this is at le

Re: Logger Wrapper + Trace API = Issues

2016-09-10 Thread Juan Fuentes
Thanks Matt and Ralph, I have extended ExtendedLoggerWrapper and it seems to work. Let’s hope I don’t stumble against other peculiarities. Thanks again! Juan > On 10 Sep 2016, at 21:44, Matt Sicker wrote: > > If there's an easier way to do it, that'd be cool, but all the bridges in > log4j it

Re: Logger Wrapper + Trace API = Issues

2016-09-10 Thread Ralph Goers
I seem to recall Remko had some magic tool that creates the wrapper for you. Ralph > On Sep 10, 2016, at 12:44 PM, Matt Sicker wrote: > > If there's an easier way to do it, that'd be cool, but all the bridges in > log4j itself use ExtendedLoggerWrapper as it is. > > On 10 September 2016 at 14:

Re: Logger Wrapper + Trace API = Issues

2016-09-10 Thread Matt Sicker
If there's an easier way to do it, that'd be cool, but all the bridges in log4j itself use ExtendedLoggerWrapper as it is. On 10 September 2016 at 14:35, Ralph Goers wrote: > Yes, you use ExtendedLoggerWrapper and pass the fully qualified class name > of your wrapper class on the logMessage call

Re: Logger Wrapper + Trace API = Issues

2016-09-10 Thread Ralph Goers
Yes, you use ExtendedLoggerWrapper and pass the fully qualified class name of your wrapper class on the logMessage call. I seem to recall there is an even easier way but it escapes me and I don’t see it documented on the web site. Ralph > On Sep 10, 2016, at 12:06 PM, Matt Sicker wrote: > > I

Re: Logger Wrapper + Trace API = Issues

2016-09-10 Thread Matt Sicker
I should note that you might want to use ExtendedLoggerWrapper in this scenario as the methods are protected otherwise that I just mentioned. On 10 September 2016 at 14:03, Matt Sicker wrote: > When you make a custom Logger wrapper, you need to use the logMessage() > methods that include the fqc

Re: Logger Wrapper + Trace API = Issues

2016-09-10 Thread Matt Sicker
When you make a custom Logger wrapper, you need to use the logMessage() methods that include the fqcn string which should be the fully qualified class name of the logger wrapper. See AbstractLogger for an example. On 10 September 2016 at 13:57, Juan Fuentes wrote: > Dear all, > > After spending

Logger Wrapper + Trace API = Issues

2016-09-10 Thread Juan Fuentes
Dear all, After spending half a day on this I have decide to try luck on the official mailing list, hopefully some dev can throw some light over this. I’m trying to use a wrapper over a Logger object to restrict the methods of the API to the ones on my interface, for example: class Log4JLogger