You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Peter DePasquale <pe...@gmail.com> on 2012/10/23 02:51:11 UTC

Two classes, logging to the same file...

Ok, I'm new, and I'm stumped.  Here's my log4j2 config file:

<?xml version="1.0" encoding="UTF-8"?>
<configuration status="debug">
	<appenders>
		<Console name="Console" target="SYSTEM_OUT">
			<PatternLayout pattern="%d{HH:mm:ss} [%t] %-5level %logger{36} - %msg%n"/>
		</Console>

		<File name="DriversFile" fileName="trace-drivers.txt"
suppressExceptions="false" append="false">
			<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} %p %C [%t] %m%n"/>
		</File>
	</appenders>
	
	<loggers>
		<logger name="org.comtor.drivers" level="trace" additivity="false">
			<appender-ref ref="DriversFile"/>
		</logger>

		<root level="error">
			<appender-ref ref="Console"/>
		</root>
	</loggers>
</configuration>

Note that the config status="debug". I have two classes that I'm
monkeying with to get Log4J2 working. They are:

org.comtor.drivers.Comtor, and
org.comtor.drivers.ComtorStandAlone

At this point, I'm only using a handful (and I mean small numbers
here) of .trace(), .entry(), and .exit() method calls.

If I do this in file #2 (ComtorStandAlone), I can get the tracing to
write to the file specified in the config file above (as well as DEBUG
statements from log4j2 on the console). Ok, cool. But when I add
logging to the first file (Comtor) thereby in theory logging from two
classes in the program, NOTHING happens. No config file logging to the
console, no output file, nothing.

Am I misunderstanding the capability to have the "org.comtor.drivers"
logger catch, process, and write to the same file? In fact, if I only
create the Logger object in the second file (private static Logger
logger = LogManager.getLogger(Comtor.class.getName());) without
attempting to call .trace(), .entry(), or .exit(), the problem
manifests itself (no output, no file, nothing).

I'd appreciate any insight here, as I'm really at a loss. Thanks.

-- 
Peter J. DePasquale, Ph.D.
Department of Computer Science
The College of New Jersey
(e) depasqua [at] tcnj [dot] edu
(p) 609-771-2806
(f) 609-637-5190
(o) Holman Hall - Room 238
(l) Holman Hall - Room 255

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: Two classes, logging to the same file...

Posted by Ralph Goers <ra...@dslextreme.com>.
That setting will have no effect in Log4j 2.

Ralph

On Oct 22, 2012, at 8:51 PM, Tim Watts wrote:

> Try invoking java with -Dlog4j.debug.  That should tell you something.
> It sounds like it's picking up a different config file from somewhere.
> 
> 
> On Mon, 2012-10-22 at 22:44 -0400, Peter DePasquale wrote:
>> Yep, both in one jar (mine), with the two log4j2 jars in the /lib/ext
>> area.  Will have to work on the zip and get back to you....
>> 
>> On Mon, Oct 22, 2012 at 10:38 PM, Ralph Goers
>> <ra...@dslextreme.com> wrote:
>>> In theory, what you are describing should be working.  Are the two
>> classes in one jar with Log4j in separate jars? Is it possible for you
>> to provide a zip of your project with the two classes exactly as it is
>> packaged?
>>> 
>>> Ralph
>>> 
>>> 
>>> On Oct 22, 2012, at 5:51 PM, Peter DePasquale wrote:
>>> 
>>>> Ok, I'm new, and I'm stumped.  Here's my log4j2 config file:
>>>> 
>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>> <configuration status="debug">
>>>>      <appenders>
>>>>              <Console name="Console" target="SYSTEM_OUT">
>>>>                      <PatternLayout pattern="%d{HH:mm:ss} [%t] %-5level %logger{36} - %msg%n"/>
>>>>              </Console>
>>>> 
>>>>              <File name="DriversFile" fileName="trace-drivers.txt"
>>>> suppressExceptions="false" append="false">
>>>>                      <PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} %p %C [%t] %m%n"/>
>>>>              </File>
>>>>      </appenders>
>>>> 
>>>>      <loggers>
>>>>              <logger name="org.comtor.drivers" level="trace" additivity="false">
>>>>                      <appender-ref ref="DriversFile"/>
>>>>              </logger>
>>>> 
>>>>              <root level="error">
>>>>                      <appender-ref ref="Console"/>
>>>>              </root>
>>>>      </loggers>
>>>> </configuration>
>>>> 
>>>> Note that the config status="debug". I have two classes that I'm
>>>> monkeying with to get Log4J2 working. They are:
>>>> 
>>>> org.comtor.drivers.Comtor, and
>>>> org.comtor.drivers.ComtorStandAlone
>>>> 
>>>> At this point, I'm only using a handful (and I mean small numbers
>>>> here) of .trace(), .entry(), and .exit() method calls.
>>>> 
>>>> If I do this in file #2 (ComtorStandAlone), I can get the tracing to
>>>> write to the file specified in the config file above (as well as DEBUG
>>>> statements from log4j2 on the console). Ok, cool. But when I add
>>>> logging to the first file (Comtor) thereby in theory logging from two
>>>> classes in the program, NOTHING happens. No config file logging to the
>>>> console, no output file, nothing.
>>>> 
>>>> Am I misunderstanding the capability to have the "org.comtor.drivers"
>>>> logger catch, process, and write to the same file? In fact, if I only
>>>> create the Logger object in the second file (private static Logger
>>>> logger = LogManager.getLogger(Comtor.class.getName());) without
>>>> attempting to call .trace(), .entry(), or .exit(), the problem
>>>> manifests itself (no output, no file, nothing).
>>>> 
>>>> I'd appreciate any insight here, as I'm really at a loss. Thanks.
>>>> 
>>>> --
>>>> Peter J. DePasquale, Ph.D.
>>>> Department of Computer Science
>>>> The College of New Jersey
>>>> (e) depasqua [at] tcnj [dot] edu
>>>> (p) 609-771-2806
>>>> (f) 609-637-5190
>>>> (o) Holman Hall - Room 238
>>>> (l) Holman Hall - Room 255
>>>> 
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>>> 
>>> 
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>> 
>> 
>> 
>> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: Two classes, logging to the same file...

Posted by Tim Watts <ti...@cliftonfarm.org>.
Try invoking java with -Dlog4j.debug.  That should tell you something.
It sounds like it's picking up a different config file from somewhere.


On Mon, 2012-10-22 at 22:44 -0400, Peter DePasquale wrote:
> Yep, both in one jar (mine), with the two log4j2 jars in the /lib/ext
> area.  Will have to work on the zip and get back to you....
> 
> On Mon, Oct 22, 2012 at 10:38 PM, Ralph Goers
> <ra...@dslextreme.com> wrote:
> > In theory, what you are describing should be working.  Are the two
> classes in one jar with Log4j in separate jars? Is it possible for you
> to provide a zip of your project with the two classes exactly as it is
> packaged?
> >
> > Ralph
> >
> >
> > On Oct 22, 2012, at 5:51 PM, Peter DePasquale wrote:
> >
> >> Ok, I'm new, and I'm stumped.  Here's my log4j2 config file:
> >>
> >> <?xml version="1.0" encoding="UTF-8"?>
> >> <configuration status="debug">
> >>       <appenders>
> >>               <Console name="Console" target="SYSTEM_OUT">
> >>                       <PatternLayout pattern="%d{HH:mm:ss} [%t] %-5level %logger{36} - %msg%n"/>
> >>               </Console>
> >>
> >>               <File name="DriversFile" fileName="trace-drivers.txt"
> >> suppressExceptions="false" append="false">
> >>                       <PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} %p %C [%t] %m%n"/>
> >>               </File>
> >>       </appenders>
> >>
> >>       <loggers>
> >>               <logger name="org.comtor.drivers" level="trace" additivity="false">
> >>                       <appender-ref ref="DriversFile"/>
> >>               </logger>
> >>
> >>               <root level="error">
> >>                       <appender-ref ref="Console"/>
> >>               </root>
> >>       </loggers>
> >> </configuration>
> >>
> >> Note that the config status="debug". I have two classes that I'm
> >> monkeying with to get Log4J2 working. They are:
> >>
> >> org.comtor.drivers.Comtor, and
> >> org.comtor.drivers.ComtorStandAlone
> >>
> >> At this point, I'm only using a handful (and I mean small numbers
> >> here) of .trace(), .entry(), and .exit() method calls.
> >>
> >> If I do this in file #2 (ComtorStandAlone), I can get the tracing to
> >> write to the file specified in the config file above (as well as DEBUG
> >> statements from log4j2 on the console). Ok, cool. But when I add
> >> logging to the first file (Comtor) thereby in theory logging from two
> >> classes in the program, NOTHING happens. No config file logging to the
> >> console, no output file, nothing.
> >>
> >> Am I misunderstanding the capability to have the "org.comtor.drivers"
> >> logger catch, process, and write to the same file? In fact, if I only
> >> create the Logger object in the second file (private static Logger
> >> logger = LogManager.getLogger(Comtor.class.getName());) without
> >> attempting to call .trace(), .entry(), or .exit(), the problem
> >> manifests itself (no output, no file, nothing).
> >>
> >> I'd appreciate any insight here, as I'm really at a loss. Thanks.
> >>
> >> --
> >> Peter J. DePasquale, Ph.D.
> >> Department of Computer Science
> >> The College of New Jersey
> >> (e) depasqua [at] tcnj [dot] edu
> >> (p) 609-771-2806
> >> (f) 609-637-5190
> >> (o) Holman Hall - Room 238
> >> (l) Holman Hall - Room 255
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> >> For additional commands, e-mail: log4j-user-help@logging.apache.org
> >>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> > For additional commands, e-mail: log4j-user-help@logging.apache.org
> >
> 
> 
> 


Re: Two classes, logging to the same file...

Posted by Peter DePasquale <pe...@gmail.com>.
I'm happy to update you once I know perfectly what I think is
happening. At that point I might have something more concrete you can
use to confirm the problem. I'll I forgot to mention, that when the
configuration file is missing from the jar file and the naming
conflict occurs that's when I'm seeing the problem. In fact, no
logging occurs at all to my output file I'm wondering if there's an
exception being thrown and caught but not producing any error messages
as I see no error output or logging output to my file.

Sent from my iPad

On Oct 29, 2012, at 10:48 PM, Ralph Goers <ra...@dslextreme.com> wrote:

> Thanks for the update. Please let me know if I can be of assistance.
>
> Ralph
>
> On Oct 29, 2012, at 7:46 PM, Peter DePasquale wrote:
>
>> I have some theories. Unfortunately, I've had to travel to Rhode Island for two talks that didn't occur because of the hurricane. Now that I'm stranded here I'm hoping to spend a little time on the issue. There's definitely a class naming resolution problem that's occurring. However I think it's only happening when the file is jarred because I can get everything to work correctly on the commandline execution approach. I was earlier able to change the name of the conflicting classes and execute the program without jarring it and all of the logging features work perfectly. I was also able to not change the names executed on the commandline and everything worked perfectly.  However once I jar of the program or create a war file for tomcat deployment the problem manifests itself again. But I have not been able to do because of time, is try the renaming approach and confirming that this is the root cause. As I said I'm stuck here in the hurricane and hoping to work on it the next day or two. However my teaching duties have distracted from my ability to work on this problem.
>>
>> Sent from my iPad
>>
>> On Oct 29, 2012, at 10:11 PM, Ralph Goers <ra...@dslextreme.com> wrote:
>>
>>> Did you make any progress on this?
>>>
>>> Ralph
>>>
>>>
>>> On Oct 23, 2012, at 1:21 PM, Peter J. DePasquale wrote:
>>>
>>>> Debugging on the train.... it's in the name of the class!!!! More later!!!!
>>>>
>>>> Ralph Goers <ra...@dslextreme.com> wrote:
>>>> BTW - I just want to make sure that you are aware that instead of unzipping all your jars and rezipping into one new jar that another alternative you have is to just place all the jars in one directory.  Then, instead of placing the log4j jars in lib/ext or combining them with your classes you would do:
>>>>
>>>>
>>>> java -cp "lib/*:target/classes" com.test.App
>>>>
>>>> Ralph
>>>>
>>>>
>>>> On Oct 23, 2012, at 11:39 AM, Peter DePasquale wrote:
>>>>
>>>>
>>>> OK, I'll try as you suggested when I can... I'm leaving to head to a
>>>> talk at Google in NYC, so this may not happen for a day or two...
>>>> trying to avoid shipping you code, but if we have to I will.
>>>>
>>>> Thanks for the help!
>>>>
>>>>
>>>> On Tue, Oct 23, 2012 at 2:36 PM, Ralph Goers
>>>> <ra...@dslextreme.com> wrote:
>>>> OK - I tried my theory and didn't have any problems.
>>>>
>>>>
>>>> Ralph
>>>>
>>>> On Oct 23, 2012, at 10:59 AM, Ralph Goers wrote:
>>>>
>>>> That is good to know. However, your test has spawned a suspicion that the problem may be related to one class starting with the name of the other.  Try renaming Comtor or ComtorStandAlone so they don't overlap and see if the problem goes away.  If it does then it is a bug in Log4j.
>>>>
>>>>
>>>> I'll try modifying my test to emulate that and see if I get the problem.
>>>>
>>>> Ralph
>>>>
>>>>
>>>> On Oct 23, 2012, at 10:35 AM, Peter DePasquale wrote:
>>>>
>>>>
>>>> So I was able to download this and replicate your results.
>>>>
>>>> I've adjusted my logger config to account for other classes in a
>>>> different package (org.comtor rather than org.comtor.drivers) and that
>>>> works. Thus, my issue apparently is specific to this particular one
>>>>
>>>> class. Debugging continues as I have the time.
>>>>
>>>> On Tue, Oct 23, 2012 at 3:47 AM, Ralph Goers <ra...@dslextreme.com> wrote:
>>>>
>>>> I copied the log4j api and core jars into /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/lib/ext/ on my Mac.  I found a project I had used before that had two classes and modified it slightly for this test.  I ran the test and got the following output (which will probably look terrible after it is emailed).   The log4j2.xml file was in the classes directory of my project so it could be found in the
>>>> classpath.  I will attempt to add the project zip to the email but I don't know if this list accepts attachments.  I also got an output file which should be in the "target" directory in the zip.
>>>>
>>>> Ralph
>>>>
>>>>
>>>> java -cp /Users/rgoers/test/log4jtest/test/target/classes com.test.App
>>>> 2012-10-23 00:44:26,908 DEBUG Generated plugins in 0.000012000 seconds
>>>> 2012-10-23 00:44:26,916 DEBUG Calling createFilter on class org.apache.logging.log4j.core.filter.ThresholdFilter for element ThresholdFilter with params(level="ERROR", onMatch="ACCEPT", onMismatch="DENY")
>>>>
>>>> 2012-10-23 00:44:26,920 DEBUG Calling createLayout on class org.apache.logging.log4j.core.layout.PatternLayout for element PatternLayout with params(pattern="%d{HH:mm:ss.SSS} %-5level %class{36} %L %M - %msg%xEx%n", Configuration, null, charset="null")
>>>>
>>>> 2012-10-23 00:44:26,920 DEBUG Generated plugins in 0.000010000 seconds
>>>> 2012-10-23 00:44:26,922 DEBUG Calling createAppender on class
>>>> org.apache.logging.log4j.core.appender.ConsoleAppender for element Console with params(PatternLayout(%d{HH:mm:ss.SSS} %-5level %class{36} %L %M - %msg%xEx%n), ThresholdFilter(ERROR), target="SYSTEM_OUT", name="Console", suppressExceptions="null")
>>>>
>>>> 2012-10-23 00:44:26,923 DEBUG Calling createLayout on class org.apache.logging.log4j.core.layout.PatternLayout for element PatternLayout with params(pattern="%d{HH:mm:ss.SSS} %-5level %class{36} %L %M - %msg%xEx%n", Configuration, null, charset="null")
>>>>
>>>> 2012-10-23 00:44:26,925 DEBUG Calling createAppender on class org.apache.logging.log4j.core.appender.FileAppender for element File with params(fileName="target/test.log", append="false", locking="null", name="log", immediateFlush="null", suppressExceptions="null", bufferedIO="null", PatternLayout(%d{HH:mm:ss.SSS} %-5level %class{36} %L %M - %msg%xEx%n), null)
>>>>
>>>> 2012-10-23 00:44:26,943 DEBUG Starting FileManager target/test.log
>>>> 2012-10-23 00:44:26,943 DEBUG Calling
>>>> createAppenders on class org.apache.logging.log4j.core.config.plugins.AppendersPlugin for element appenders with params(appenders={Console, log})
>>>> 2012-10-23 00:44:26,944 DEBUG Generated plugins in 0.000016000 seconds
>>>>
>>>> 2012-10-23 00:44:26,945 DEBUG Calling createAppenderRef on class org.apache.logging.log4j.core.config.AppenderRef for element appender-ref with params(ref="log", level="null", null)
>>>> 2012-10-23 00:44:26,946 DEBUG Calling createLogger on class org.apache.logging.log4j.core.config.LoggerConfig for element logger with params(additivity="false", level="trace", name="com.test", appender-ref={org.apache.logging.log4j.core.config.AppenderRef@44a613f8}, properties={}, Configuration, null)
>>>>
>>>> 2012-10-23 00:44:26,947 DEBUG Calling createAppenderRef on class org.apache.logging.log4j.core.config.AppenderRef for element appender-ref with params(ref="Console", level="null", null)
>>>> 2012-10-23 00:44:26,948 DEBUG Calling createLogger on class
>>>> org.apache.logging.log4j.core.config.LoggerConfig$RootLogger for element root with params(additivity="null", level="debug", appender-ref={org.apache.logging.log4j.core.config.AppenderRef@736921fd}, properties={}, Configuration, null)
>>>>
>>>> 2012-10-23 00:44:26,949 DEBUG Calling createLoggers on class org.apache.logging.log4j.core.config.plugins.LoggersPlugin for element loggers with params(loggers={com.test, root})
>>>> 2012-10-23 00:44:26,950 DEBUG Reconfiguration completed
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On Oct 22, 2012, at 10:02 PM, Ralph Goers wrote:
>>>>
>>>> OK - I haven't tried installing into lib/ext. I will see if I can create a couple of classes to emulate what you are describing until you can get me a zip. I assume one or both of these has a main?  Where did you place log4j2.xml?
>>>>
>>>>
>>>> Ralph
>>>>
>>>> On Oct 22, 2012, at 7:44 PM, Peter
>>>> DePasquale wrote:
>>>>
>>>> Yep, both in one jar (mine), with the two log4j2 jars in the /lib/ext
>>>> area.  Will have to work on the zip and get back to you....
>>>>
>>>>
>>>> On Mon, Oct 22, 2012 at 10:38 PM, Ralph Goers
>>>> <ra...@dslextreme.com> wrote:
>>>>
>>>> In theory, what you are describing should be working.  Are the two classes in one jar with Log4j in separate jars? Is it possible for you to provide a zip of your project with the two classes exactly as it is packaged?
>>>>
>>>>
>>>> Ralph
>>>>
>>>>
>>>> On Oct 22, 2012, at 5:51 PM, Peter DePasquale wrote:
>>>>
>>>> Ok, I'm new, and I'm stumped.  Here's my log4j2 config
>>>> file:
>>>>
>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>> <configuration status="debug">
>>>> <appenders>
>>>> <Console name="Console" target="SYSTEM_OUT">
>>>>
>>>> <PatternLayout pattern="%d{HH:mm:ss} [%t] %-5level %logger{36} - %msg%n"/>
>>>> </Console>
>>>>
>>>> <File name="DriversFile" fileName="trace-drivers.txt"
>>>> suppressExceptions="false" append="false">
>>>>
>>>> <PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} %p %C [%t] %m%n"/>
>>>> </File>
>>>> </appenders>
>>>>
>>>> <loggers>
>>>> <logger name="org.comtor.drivers" level="trace" additivity="false">
>>>>
>>>> <appender-ref ref="DriversFile"/>
>>>> </logger>
>>>>
>>>> <root level="error">
>>>> <appender-ref ref="Console"/>
>>>> </root>
>>>> </loggers>
>>>> </configuration>
>>>>
>>>>
>>>> Note that the config status="debug". I have two classes that I'm
>>>> monkeying with to get Log4J2 working. They are:
>>>>
>>>> org.comtor.drivers.Comtor, and
>>>> org.comtor.drivers.ComtorStandAlone
>>>>
>>>> At this point, I'm only using a handful (and I mean small numbers
>>>>
>>>> here) of .trace(), .entry(), and .exit() method calls.
>>>>
>>>> If I do this in file #2 (ComtorStandAlone), I can get the tracing to
>>>> write to the file specified in the config file above (as well as DEBUG
>>>> statements from log4j2 on the console). Ok, cool. But when I add
>>>>
>>>> logging to the first file (Comtor) thereby in theory logging from two
>>>> classes in the program, NOTHING happens. No config file logging to the
>>>> console, no output file, nothing.
>>>>
>>>> Am I misunderstanding the capability to have the "org.comtor.drivers"
>>>>
>>>> logger catch, process, and write to the same file? In fact, if I only
>>>> create the Logger object in the second file (private static Logger
>>>> logger = LogManager.getLogger(Comtor.class.getName());) without
>>>> attempting to call .trace(), .entry(), or .exit(), the problem
>>>>
>>>> manifests itself (no output, no file, nothing).
>>>>
>>>> I'd appreciate any insight here, as I'm really at a loss. Thanks.
>>>>
>>>> --
>>>> Peter J. DePasquale, Ph.D.
>>>> Department of Computer Science
>>>> The College of New Jersey
>>>>
>>>> (e) depasqua [at] tcnj [dot] edu
>>>> (p) 609-771-2806
>>>> (f) 609-637-5190
>>>> (o) Holman Hall - Room 238
>>>> (l) Holman Hall - Room 255
>>>>
>>>>
>>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>>>
>>>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>>>
>>>>
>>>>
>>>>
>>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>>>
>>>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Peter J. DePasquale, Ph.D.
>>>> Department of Computer Science
>>>>
>>>> The College of New Jersey
>>>> (e) depasqua [at] tcnj [dot] edu
>>>> (p) 609-771-2806
>>>> (f) 609-637-5190
>>>> (o) Holman Hall - Room 238
>>>> (l) Holman
>>>> Hall - Room 255
>>>>
>>>>
>>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Peter J. DePasquale, Ph.D.
>>>> Department of Computer Science
>>>> The College of New Jersey
>>>> (e) depasqua [at] tcnj [dot] edu
>>>> (p) 609-771-2806
>>>> (f) 609-637-5190
>>>> (o) Holman Hall - Room 238
>>>> (l) Holman Hall - Room 255
>>>>
>>>>
>>>>
>>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>>> For additional commands, e-mail:
>>>> log4j-user-help@logging.apache.org
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Peter J. DePasquale, Ph.D.
>>>> Department of Computer Science
>>>> The College of New Jersey
>>>> (e) depasqua [at] tcnj [dot] edu
>>>>
>>>> (p) 609-771-2806
>>>> (f) 609-637-5190
>>>> (o) Holman Hall - Room 238
>>>> (l) Holman Hall - Room 255
>>>>
>>>>
>>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>>>
>>>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>>>
>>>>
>>>>
>>>>
>>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>>>
>>>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>>>
>>>>
>>>> --
>>>> Sent from my Android phone with K-9 Mail. Please excuse my brevity.
>>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: Two classes, logging to the same file...

Posted by Ralph Goers <ra...@dslextreme.com>.
Thanks for the update. Please let me know if I can be of assistance.

Ralph

On Oct 29, 2012, at 7:46 PM, Peter DePasquale wrote:

> I have some theories. Unfortunately, I've had to travel to Rhode Island for two talks that didn't occur because of the hurricane. Now that I'm stranded here I'm hoping to spend a little time on the issue. There's definitely a class naming resolution problem that's occurring. However I think it's only happening when the file is jarred because I can get everything to work correctly on the commandline execution approach. I was earlier able to change the name of the conflicting classes and execute the program without jarring it and all of the logging features work perfectly. I was also able to not change the names executed on the commandline and everything worked perfectly.  However once I jar of the program or create a war file for tomcat deployment the problem manifests itself again. But I have not been able to do because of time, is try the renaming approach and confirming that this is the root cause. As I said I'm stuck here in the hurricane and hoping to work on it the next day or two. However my teaching duties have distracted from my ability to work on this problem.
> 
> Sent from my iPad
> 
> On Oct 29, 2012, at 10:11 PM, Ralph Goers <ra...@dslextreme.com> wrote:
> 
>> Did you make any progress on this?
>> 
>> Ralph
>> 
>> 
>> On Oct 23, 2012, at 1:21 PM, Peter J. DePasquale wrote:
>> 
>>> Debugging on the train.... it's in the name of the class!!!! More later!!!!
>>> 
>>> Ralph Goers <ra...@dslextreme.com> wrote:
>>> BTW - I just want to make sure that you are aware that instead of unzipping all your jars and rezipping into one new jar that another alternative you have is to just place all the jars in one directory.  Then, instead of placing the log4j jars in lib/ext or combining them with your classes you would do:
>>> 
>>> 
>>> java -cp "lib/*:target/classes" com.test.App
>>> 
>>> Ralph
>>> 
>>> 
>>> On Oct 23, 2012, at 11:39 AM, Peter DePasquale wrote:
>>> 
>>> 
>>> OK, I'll try as you suggested when I can... I'm leaving to head to a
>>> talk at Google in NYC, so this may not happen for a day or two...
>>> trying to avoid shipping you code, but if we have to I will.
>>> 
>>> Thanks for the help!
>>> 
>>> 
>>> On Tue, Oct 23, 2012 at 2:36 PM, Ralph Goers
>>> <ra...@dslextreme.com> wrote:
>>> OK - I tried my theory and didn't have any problems.
>>> 
>>> 
>>> Ralph
>>> 
>>> On Oct 23, 2012, at 10:59 AM, Ralph Goers wrote:
>>> 
>>> That is good to know. However, your test has spawned a suspicion that the problem may be related to one class starting with the name of the other.  Try renaming Comtor or ComtorStandAlone so they don't overlap and see if the problem goes away.  If it does then it is a bug in Log4j.
>>> 
>>> 
>>> I'll try modifying my test to emulate that and see if I get the problem.
>>> 
>>> Ralph
>>> 
>>> 
>>> On Oct 23, 2012, at 10:35 AM, Peter DePasquale wrote:
>>> 
>>> 
>>> So I was able to download this and replicate your results.
>>> 
>>> I've adjusted my logger config to account for other classes in a
>>> different package (org.comtor rather than org.comtor.drivers) and that
>>> works. Thus, my issue apparently is specific to this particular one
>>> 
>>> class. Debugging continues as I have the time.
>>> 
>>> On Tue, Oct 23, 2012 at 3:47 AM, Ralph Goers <ra...@dslextreme.com> wrote:
>>> 
>>> I copied the log4j api and core jars into /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/lib/ext/ on my Mac.  I found a project I had used before that had two classes and modified it slightly for this test.  I ran the test and got the following output (which will probably look terrible after it is emailed).   The log4j2.xml file was in the classes directory of my project so it could be found in the
>>> classpath.  I will attempt to add the project zip to the email but I don't know if this list accepts attachments.  I also got an output file which should be in the "target" directory in the zip.
>>> 
>>> Ralph
>>> 
>>> 
>>> java -cp /Users/rgoers/test/log4jtest/test/target/classes com.test.App
>>> 2012-10-23 00:44:26,908 DEBUG Generated plugins in 0.000012000 seconds
>>> 2012-10-23 00:44:26,916 DEBUG Calling createFilter on class org.apache.logging.log4j.core.filter.ThresholdFilter for element ThresholdFilter with params(level="ERROR", onMatch="ACCEPT", onMismatch="DENY")
>>> 
>>> 2012-10-23 00:44:26,920 DEBUG Calling createLayout on class org.apache.logging.log4j.core.layout.PatternLayout for element PatternLayout with params(pattern="%d{HH:mm:ss.SSS} %-5level %class{36} %L %M - %msg%xEx%n", Configuration, null, charset="null")
>>> 
>>> 2012-10-23 00:44:26,920 DEBUG Generated plugins in 0.000010000 seconds
>>> 2012-10-23 00:44:26,922 DEBUG Calling createAppender on class
>>> org.apache.logging.log4j.core.appender.ConsoleAppender for element Console with params(PatternLayout(%d{HH:mm:ss.SSS} %-5level %class{36} %L %M - %msg%xEx%n), ThresholdFilter(ERROR), target="SYSTEM_OUT", name="Console", suppressExceptions="null")
>>> 
>>> 2012-10-23 00:44:26,923 DEBUG Calling createLayout on class org.apache.logging.log4j.core.layout.PatternLayout for element PatternLayout with params(pattern="%d{HH:mm:ss.SSS} %-5level %class{36} %L %M - %msg%xEx%n", Configuration, null, charset="null")
>>> 
>>> 2012-10-23 00:44:26,925 DEBUG Calling createAppender on class org.apache.logging.log4j.core.appender.FileAppender for element File with params(fileName="target/test.log", append="false", locking="null", name="log", immediateFlush="null", suppressExceptions="null", bufferedIO="null", PatternLayout(%d{HH:mm:ss.SSS} %-5level %class{36} %L %M - %msg%xEx%n), null)
>>> 
>>> 2012-10-23 00:44:26,943 DEBUG Starting FileManager target/test.log
>>> 2012-10-23 00:44:26,943 DEBUG Calling
>>> createAppenders on class org.apache.logging.log4j.core.config.plugins.AppendersPlugin for element appenders with params(appenders={Console, log})
>>> 2012-10-23 00:44:26,944 DEBUG Generated plugins in 0.000016000 seconds
>>> 
>>> 2012-10-23 00:44:26,945 DEBUG Calling createAppenderRef on class org.apache.logging.log4j.core.config.AppenderRef for element appender-ref with params(ref="log", level="null", null)
>>> 2012-10-23 00:44:26,946 DEBUG Calling createLogger on class org.apache.logging.log4j.core.config.LoggerConfig for element logger with params(additivity="false", level="trace", name="com.test", appender-ref={org.apache.logging.log4j.core.config.AppenderRef@44a613f8}, properties={}, Configuration, null)
>>> 
>>> 2012-10-23 00:44:26,947 DEBUG Calling createAppenderRef on class org.apache.logging.log4j.core.config.AppenderRef for element appender-ref with params(ref="Console", level="null", null)
>>> 2012-10-23 00:44:26,948 DEBUG Calling createLogger on class
>>> org.apache.logging.log4j.core.config.LoggerConfig$RootLogger for element root with params(additivity="null", level="debug", appender-ref={org.apache.logging.log4j.core.config.AppenderRef@736921fd}, properties={}, Configuration, null)
>>> 
>>> 2012-10-23 00:44:26,949 DEBUG Calling createLoggers on class org.apache.logging.log4j.core.config.plugins.LoggersPlugin for element loggers with params(loggers={com.test, root})
>>> 2012-10-23 00:44:26,950 DEBUG Reconfiguration completed
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> On Oct 22, 2012, at 10:02 PM, Ralph Goers wrote:
>>> 
>>> OK - I haven't tried installing into lib/ext. I will see if I can create a couple of classes to emulate what you are describing until you can get me a zip. I assume one or both of these has a main?  Where did you place log4j2.xml?
>>> 
>>> 
>>> Ralph
>>> 
>>> On Oct 22, 2012, at 7:44 PM, Peter
>>> DePasquale wrote:
>>> 
>>> Yep, both in one jar (mine), with the two log4j2 jars in the /lib/ext
>>> area.  Will have to work on the zip and get back to you....
>>> 
>>> 
>>> On Mon, Oct 22, 2012 at 10:38 PM, Ralph Goers
>>> <ra...@dslextreme.com> wrote:
>>> 
>>> In theory, what you are describing should be working.  Are the two classes in one jar with Log4j in separate jars? Is it possible for you to provide a zip of your project with the two classes exactly as it is packaged?
>>> 
>>> 
>>> Ralph
>>> 
>>> 
>>> On Oct 22, 2012, at 5:51 PM, Peter DePasquale wrote:
>>> 
>>> Ok, I'm new, and I'm stumped.  Here's my log4j2 config
>>> file:
>>> 
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <configuration status="debug">
>>> <appenders>
>>> <Console name="Console" target="SYSTEM_OUT">
>>> 
>>> <PatternLayout pattern="%d{HH:mm:ss} [%t] %-5level %logger{36} - %msg%n"/>
>>> </Console>
>>> 
>>> <File name="DriversFile" fileName="trace-drivers.txt"
>>> suppressExceptions="false" append="false">
>>> 
>>> <PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} %p %C [%t] %m%n"/>
>>> </File>
>>> </appenders>
>>> 
>>> <loggers>
>>> <logger name="org.comtor.drivers" level="trace" additivity="false">
>>> 
>>> <appender-ref ref="DriversFile"/>
>>> </logger>
>>> 
>>> <root level="error">
>>> <appender-ref ref="Console"/>
>>> </root>
>>> </loggers>
>>> </configuration>
>>> 
>>> 
>>> Note that the config status="debug". I have two classes that I'm
>>> monkeying with to get Log4J2 working. They are:
>>> 
>>> org.comtor.drivers.Comtor, and
>>> org.comtor.drivers.ComtorStandAlone
>>> 
>>> At this point, I'm only using a handful (and I mean small numbers
>>> 
>>> here) of .trace(), .entry(), and .exit() method calls.
>>> 
>>> If I do this in file #2 (ComtorStandAlone), I can get the tracing to
>>> write to the file specified in the config file above (as well as DEBUG
>>> statements from log4j2 on the console). Ok, cool. But when I add
>>> 
>>> logging to the first file (Comtor) thereby in theory logging from two
>>> classes in the program, NOTHING happens. No config file logging to the
>>> console, no output file, nothing.
>>> 
>>> Am I misunderstanding the capability to have the "org.comtor.drivers"
>>> 
>>> logger catch, process, and write to the same file? In fact, if I only
>>> create the Logger object in the second file (private static Logger
>>> logger = LogManager.getLogger(Comtor.class.getName());) without
>>> attempting to call .trace(), .entry(), or .exit(), the problem
>>> 
>>> manifests itself (no output, no file, nothing).
>>> 
>>> I'd appreciate any insight here, as I'm really at a loss. Thanks.
>>> 
>>> --
>>> Peter J. DePasquale, Ph.D.
>>> Department of Computer Science
>>> The College of New Jersey
>>> 
>>> (e) depasqua [at] tcnj [dot] edu
>>> (p) 609-771-2806
>>> (f) 609-637-5190
>>> (o) Holman Hall - Room 238
>>> (l) Holman Hall - Room 255
>>> 
>>> 
>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>> 
>>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>> 
>>> 
>>> 
>>> 
>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>> 
>>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>> 
>>> 
>>> 
>>> 
>>> --
>>> Peter J. DePasquale, Ph.D.
>>> Department of Computer Science
>>> 
>>> The College of New Jersey
>>> (e) depasqua [at] tcnj [dot] edu
>>> (p) 609-771-2806
>>> (f) 609-637-5190
>>> (o) Holman Hall - Room 238
>>> (l) Holman
>>> Hall - Room 255
>>> 
>>> 
>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>> 
>>> 
>>> 
>>> 
>>> --
>>> Peter J. DePasquale, Ph.D.
>>> Department of Computer Science
>>> The College of New Jersey
>>> (e) depasqua [at] tcnj [dot] edu
>>> (p) 609-771-2806
>>> (f) 609-637-5190
>>> (o) Holman Hall - Room 238
>>> (l) Holman Hall - Room 255
>>> 
>>> 
>>> 
>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>> For additional commands, e-mail:
>>> log4j-user-help@logging.apache.org
>>> 
>>> 
>>> 
>>> 
>>> -- 
>>> Peter J. DePasquale, Ph.D.
>>> Department of Computer Science
>>> The College of New Jersey
>>> (e) depasqua [at] tcnj [dot] edu
>>> 
>>> (p) 609-771-2806
>>> (f) 609-637-5190
>>> (o) Holman Hall - Room 238
>>> (l) Holman Hall - Room 255
>>> 
>>> 
>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>> 
>>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>> 
>>> 
>>> 
>>> 
>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>> 
>>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>> 
>>> 
>>> -- 
>>> Sent from my Android phone with K-9 Mail. Please excuse my brevity.
>> 


Re: Two classes, logging to the same file...

Posted by Ralph Goers <ra...@dslextreme.com>.
Did you make any progress on this?

Ralph


On Oct 23, 2012, at 1:21 PM, Peter J. DePasquale wrote:

> Debugging on the train.... it's in the name of the class!!!! More later!!!!
> 
> Ralph Goers <ra...@dslextreme.com> wrote:
> BTW - I just want to make sure that you are aware that instead of unzipping all your jars and rezipping into one new jar that another alternative you have is to just place all the jars in one directory.  Then, instead of placing the log4j jars in lib/ext or combining them with your classes you would do:
> 
> java -cp "lib/*:target/classes" com.test.App
> 
> Ralph
> 
> 
> On Oct 23, 2012, at 11:39 AM, Peter DePasquale wrote:
> 
> OK, I'll try as you suggested when I can... I'm leaving to head to a
> talk at Google in NYC, so this may not happen for a day or two...
> trying to avoid shipping you code, but if we have to I will.
> 
> Thanks for the help!
> 
> On Tue, Oct 23, 2012 at 2:36 PM, Ralph Goers
> <ra...@dslextreme.com> wrote:
> OK - I tried my theory and didn't have any problems.
> 
> Ralph
> 
> On Oct 23, 2012, at 10:59 AM, Ralph Goers wrote:
> 
> That is good to know. However, your test has spawned a suspicion that the problem may be related to one class starting with the name of the other.  Try renaming Comtor or ComtorStandAlone so they don't overlap and see if the problem goes away.  If it does then it is a bug in Log4j.
> 
> I'll try modifying my test to emulate that and see if I get the problem.
> 
> Ralph
> 
> 
> On Oct 23, 2012, at 10:35 AM, Peter DePasquale wrote:
> 
> So I was able to download this and replicate your results.
> 
> I've adjusted my logger config to account for other classes in a
> different package (org.comtor rather than org.comtor.drivers) and that
> works. Thus, my issue apparently is specific to this particular one
> class. Debugging continues as I have the time.
> 
> On Tue, Oct 23, 2012 at 3:47 AM, Ralph Goers <ra...@dslextreme.com> wrote:
> I copied the log4j api and core jars into /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/lib/ext/ on my Mac.  I found a project I had used before that had two classes and modified it slightly for this test.  I ran the test and got the following output (which will probably look terrible after it is emailed).   The log4j2.xml file was in the classes directory of my project so it could be found in the
> classpath.  I will attempt to add the project zip to the email but I don't know if this list accepts attachments.  I also got an output file which should be in the "target" directory in the zip.
> 
> Ralph
> 
> java -cp /Users/rgoers/test/log4jtest/test/target/classes com.test.App
> 2012-10-23 00:44:26,908 DEBUG Generated plugins in 0.000012000 seconds
> 2012-10-23 00:44:26,916 DEBUG Calling createFilter on class org.apache.logging.log4j.core.filter.ThresholdFilter for element ThresholdFilter with params(level="ERROR", onMatch="ACCEPT", onMismatch="DENY")
> 2012-10-23 00:44:26,920 DEBUG Calling createLayout on class org.apache.logging.log4j.core.layout.PatternLayout for element PatternLayout with params(pattern="%d{HH:mm:ss.SSS} %-5level %class{36} %L %M - %msg%xEx%n", Configuration, null, charset="null")
> 2012-10-23 00:44:26,920 DEBUG Generated plugins in 0.000010000 seconds
> 2012-10-23 00:44:26,922 DEBUG Calling createAppender on class
> org.apache.logging.log4j.core.appender.ConsoleAppender for element Console with params(PatternLayout(%d{HH:mm:ss.SSS} %-5level %class{36} %L %M - %msg%xEx%n), ThresholdFilter(ERROR), target="SYSTEM_OUT", name="Console", suppressExceptions="null")
> 2012-10-23 00:44:26,923 DEBUG Calling createLayout on class org.apache.logging.log4j.core.layout.PatternLayout for element PatternLayout with params(pattern="%d{HH:mm:ss.SSS} %-5level %class{36} %L %M - %msg%xEx%n", Configuration, null, charset="null")
> 2012-10-23 00:44:26,925 DEBUG Calling createAppender on class org.apache.logging.log4j.core.appender.FileAppender for element File with params(fileName="target/test.log", append="false", locking="null", name="log", immediateFlush="null", suppressExceptions="null", bufferedIO="null", PatternLayout(%d{HH:mm:ss.SSS} %-5level %class{36} %L %M - %msg%xEx%n), null)
> 2012-10-23 00:44:26,943 DEBUG Starting FileManager target/test.log
> 2012-10-23 00:44:26,943 DEBUG Calling
> createAppenders on class org.apache.logging.log4j.core.config.plugins.AppendersPlugin for element appenders with params(appenders={Console, log})
> 2012-10-23 00:44:26,944 DEBUG Generated plugins in 0.000016000 seconds
> 2012-10-23 00:44:26,945 DEBUG Calling createAppenderRef on class org.apache.logging.log4j.core.config.AppenderRef for element appender-ref with params(ref="log", level="null", null)
> 2012-10-23 00:44:26,946 DEBUG Calling createLogger on class org.apache.logging.log4j.core.config.LoggerConfig for element logger with params(additivity="false", level="trace", name="com.test", appender-ref={org.apache.logging.log4j.core.config.AppenderRef@44a613f8}, properties={}, Configuration, null)
> 2012-10-23 00:44:26,947 DEBUG Calling createAppenderRef on class org.apache.logging.log4j.core.config.AppenderRef for element appender-ref with params(ref="Console", level="null", null)
> 2012-10-23 00:44:26,948 DEBUG Calling createLogger on class
> org.apache.logging.log4j.core.config.LoggerConfig$RootLogger for element root with params(additivity="null", level="debug", appender-ref={org.apache.logging.log4j.core.config.AppenderRef@736921fd}, properties={}, Configuration, null)
> 2012-10-23 00:44:26,949 DEBUG Calling createLoggers on class org.apache.logging.log4j.core.config.plugins.LoggersPlugin for element loggers with params(loggers={com.test, root})
> 2012-10-23 00:44:26,950 DEBUG Reconfiguration completed
> 
> 
> 
> 
> 
> 
> On Oct 22, 2012, at 10:02 PM, Ralph Goers wrote:
> 
> OK - I haven't tried installing into lib/ext. I will see if I can create a couple of classes to emulate what you are describing until you can get me a zip. I assume one or both of these has a main?  Where did you place log4j2.xml?
> 
> Ralph
> 
> On Oct 22, 2012, at 7:44 PM, Peter
> DePasquale wrote:
> 
> Yep, both in one jar (mine), with the two log4j2 jars in the /lib/ext
> area.  Will have to work on the zip and get back to you....
> 
> On Mon, Oct 22, 2012 at 10:38 PM, Ralph Goers
> <ra...@dslextreme.com> wrote:
> In theory, what you are describing should be working.  Are the two classes in one jar with Log4j in separate jars? Is it possible for you to provide a zip of your project with the two classes exactly as it is packaged?
> 
> Ralph
> 
> 
> On Oct 22, 2012, at 5:51 PM, Peter DePasquale wrote:
> 
> Ok, I'm new, and I'm stumped.  Here's my log4j2 config
> file:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <configuration status="debug">
> <appenders>
> <Console name="Console" target="SYSTEM_OUT">
> <PatternLayout pattern="%d{HH:mm:ss} [%t] %-5level %logger{36} - %msg%n"/>
> </Console>
> 
> <File name="DriversFile" fileName="trace-drivers.txt"
> suppressExceptions="false" append="false">
> <PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} %p %C [%t] %m%n"/>
> </File>
> </appenders>
> 
> <loggers>
> <logger name="org.comtor.drivers" level="trace" additivity="false">
> <appender-ref ref="DriversFile"/>
> </logger>
> 
> <root level="error">
> <appender-ref ref="Console"/>
> </root>
> </loggers>
> </configuration>
> 
> Note that the config status="debug". I have two classes that I'm
> monkeying with to get Log4J2 working. They are:
> 
> org.comtor.drivers.Comtor, and
> org.comtor.drivers.ComtorStandAlone
> 
> At this point, I'm only using a handful (and I mean small numbers
> here) of .trace(), .entry(), and .exit() method calls.
> 
> If I do this in file #2 (ComtorStandAlone), I can get the tracing to
> write to the file specified in the config file above (as well as DEBUG
> statements from log4j2 on the console). Ok, cool. But when I add
> logging to the first file (Comtor) thereby in theory logging from two
> classes in the program, NOTHING happens. No config file logging to the
> console, no output file, nothing.
> 
> Am I misunderstanding the capability to have the "org.comtor.drivers"
> logger catch, process, and write to the same file? In fact, if I only
> create the Logger object in the second file (private static Logger
> logger = LogManager.getLogger(Comtor.class.getName());) without
> attempting to call .trace(), .entry(), or .exit(), the problem
> manifests itself (no output, no file, nothing).
> 
> I'd appreciate any insight here, as I'm really at a loss. Thanks.
> 
> --
> Peter J. DePasquale, Ph.D.
> Department of Computer Science
> The College of New Jersey
> (e) depasqua [at] tcnj [dot] edu
> (p) 609-771-2806
> (f) 609-637-5190
> (o) Holman Hall - Room 238
> (l) Holman Hall - Room 255
> 
> 
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> 
> 
> 
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> 
> 
> 
> --
> Peter J. DePasquale, Ph.D.
> Department of Computer Science
> The College of New Jersey
> (e) depasqua [at] tcnj [dot] edu
> (p) 609-771-2806
> (f) 609-637-5190
> (o) Holman Hall - Room 238
> (l) Holman
> Hall - Room 255
> 
> 
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> 
> 
> 
> 
> 
> 
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> 
> 
> --
> Peter J. DePasquale, Ph.D.
> Department of Computer Science
> The College of New Jersey
> (e) depasqua [at] tcnj [dot] edu
> (p) 609-771-2806
> (f) 609-637-5190
> (o) Holman Hall - Room 238
> (l) Holman Hall - Room 255
> 
> 
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> 
> 
> 
> 
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail:
> log4j-user-help@logging.apache.org
> 
> 
> 
> 
> -- 
> Peter J. DePasquale, Ph.D.
> Department of Computer Science
> The College of New Jersey
> (e) depasqua [at] tcnj [dot] edu
> (p) 609-771-2806
> (f) 609-637-5190
> (o) Holman Hall - Room 238
> (l) Holman Hall - Room 255
> 
> 
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> 
> 
> 
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> 
> -- 
> Sent from my Android phone with K-9 Mail. Please excuse my brevity.


Re: Two classes, logging to the same file...

Posted by "Peter J. DePasquale" <pe...@gmail.com>.
Debugging on the train.... it's in the name of the class!!!! More later!!!!

Ralph Goers <ra...@dslextreme.com> wrote:

>BTW - I just want to make sure that you are aware that instead of
>unzipping all your jars and rezipping into one new jar that another
>alternative you have is to just place all the jars in one directory. 
>Then, instead of placing the log4j jars in lib/ext or combining them
>with your classes you would do:
>
>java -cp "lib/*:target/classes" com.test.App
>
>Ralph
>
>
>On Oct 23, 2012, at 11:39 AM, Peter DePasquale wrote:
>
>> OK, I'll try as you suggested when I can... I'm leaving to head to a
>> talk at Google in NYC, so this may not happen for a day or two...
>> trying to avoid shipping you code, but if we have to I will.
>> 
>> Thanks for the help!
>> 
>> On Tue, Oct 23, 2012 at 2:36 PM, Ralph Goers
><ra...@dslextreme.com> wrote:
>>> OK - I tried my theory and didn't have any problems.
>>> 
>>> Ralph
>>> 
>>> On Oct 23, 2012, at 10:59 AM, Ralph Goers wrote:
>>> 
>>>> That is good to know. However, your test has spawned a suspicion
>that the problem may be related to one class starting with the name of
>the other.  Try renaming Comtor or ComtorStandAlone so they don't
>overlap and see if the problem goes away.  If it does then it is a bug
>in Log4j.
>>>> 
>>>> I'll try modifying my test to emulate that and see if I get the
>problem.
>>>> 
>>>> Ralph
>>>> 
>>>> 
>>>> On Oct 23, 2012, at 10:35 AM, Peter DePasquale wrote:
>>>> 
>>>>> So I was able to download this and replicate your results.
>>>>> 
>>>>> I've adjusted my logger config to account for other classes in a
>>>>> different package (org.comtor rather than org.comtor.drivers) and
>that
>>>>> works. Thus, my issue apparently is specific to this particular
>one
>>>>> class. Debugging continues as I have the time.
>>>>> 
>>>>> On Tue, Oct 23, 2012 at 3:47 AM, Ralph Goers
><ra...@dslextreme.com> wrote:
>>>>>> I copied the log4j api and core jars into
>/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/lib/ext/
>on my Mac.  I found a project I had used before that had two classes
>and modified it slightly for this test.  I ran the test and got the
>following output (which will probably look terrible after it is
>emailed).   The log4j2.xml file was in the classes directory of my
>project so it could be found in the classpath.  I will attempt to add
>the project zip to the email but I don't know if this list accepts
>attachments.  I also got an output file which should be in the "target"
>directory in the zip.
>>>>>> 
>>>>>> Ralph
>>>>>> 
>>>>>> java -cp /Users/rgoers/test/log4jtest/test/target/classes
>com.test.App
>>>>>> 2012-10-23 00:44:26,908 DEBUG Generated plugins in 0.000012000
>seconds
>>>>>> 2012-10-23 00:44:26,916 DEBUG Calling createFilter on class
>org.apache.logging.log4j.core.filter.ThresholdFilter for element
>ThresholdFilter with params(level="ERROR", onMatch="ACCEPT",
>onMismatch="DENY")
>>>>>> 2012-10-23 00:44:26,920 DEBUG Calling createLayout on class
>org.apache.logging.log4j.core.layout.PatternLayout for element
>PatternLayout with params(pattern="%d{HH:mm:ss.SSS} %-5level %class{36}
>%L %M - %msg%xEx%n", Configuration, null, charset="null")
>>>>>> 2012-10-23 00:44:26,920 DEBUG Generated plugins in 0.000010000
>seconds
>>>>>> 2012-10-23 00:44:26,922 DEBUG Calling createAppender on class
>org.apache.logging.log4j.core.appender.ConsoleAppender for element
>Console with params(PatternLayout(%d{HH:mm:ss.SSS} %-5level %class{36}
>%L %M - %msg%xEx%n), ThresholdFilter(ERROR), target="SYSTEM_OUT",
>name="Console", suppressExceptions="null")
>>>>>> 2012-10-23 00:44:26,923 DEBUG Calling createLayout on class
>org.apache.logging.log4j.core.layout.PatternLayout for element
>PatternLayout with params(pattern="%d{HH:mm:ss.SSS} %-5level %class{36}
>%L %M - %msg%xEx%n", Configuration, null, charset="null")
>>>>>> 2012-10-23 00:44:26,925 DEBUG Calling createAppender on class
>org.apache.logging.log4j.core.appender.FileAppender for element File
>with params(fileName="target/test.log", append="false", locking="null",
>name="log", immediateFlush="null", suppressExceptions="null",
>bufferedIO="null", PatternLayout(%d{HH:mm:ss.SSS} %-5level %class{36}
>%L %M - %msg%xEx%n), null)
>>>>>> 2012-10-23 00:44:26,943 DEBUG Starting FileManager
>target/test.log
>>>>>> 2012-10-23 00:44:26,943 DEBUG Calling createAppenders on class
>org.apache.logging.log4j.core.config.plugins.AppendersPlugin for
>element appenders with params(appenders={Console, log})
>>>>>> 2012-10-23 00:44:26,944 DEBUG Generated plugins in 0.000016000
>seconds
>>>>>> 2012-10-23 00:44:26,945 DEBUG Calling createAppenderRef on class
>org.apache.logging.log4j.core.config.AppenderRef for element
>appender-ref with params(ref="log", level="null", null)
>>>>>> 2012-10-23 00:44:26,946 DEBUG Calling createLogger on class
>org.apache.logging.log4j.core.config.LoggerConfig for element logger
>with params(additivity="false", level="trace", name="com.test",
>appender-ref={org.apache.logging.log4j.core.config.AppenderRef@44a613f8},
>properties={}, Configuration, null)
>>>>>> 2012-10-23 00:44:26,947 DEBUG Calling createAppenderRef on class
>org.apache.logging.log4j.core.config.AppenderRef for element
>appender-ref with params(ref="Console", level="null", null)
>>>>>> 2012-10-23 00:44:26,948 DEBUG Calling createLogger on class
>org.apache.logging.log4j.core.config.LoggerConfig$RootLogger for
>element root with params(additivity="null", level="debug",
>appender-ref={org.apache.logging.log4j.core.config.AppenderRef@736921fd},
>properties={}, Configuration, null)
>>>>>> 2012-10-23 00:44:26,949 DEBUG Calling createLoggers on class
>org.apache.logging.log4j.core.config.plugins.LoggersPlugin for element
>loggers with params(loggers={com.test, root})
>>>>>> 2012-10-23 00:44:26,950 DEBUG Reconfiguration completed
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> On Oct 22, 2012, at 10:02 PM, Ralph Goers wrote:
>>>>>> 
>>>>>>> OK - I haven't tried installing into lib/ext. I will see if I
>can create a couple of classes to emulate what you are describing until
>you can get me a zip. I assume one or both of these has a main?  Where
>did you place log4j2.xml?
>>>>>>> 
>>>>>>> Ralph
>>>>>>> 
>>>>>>> On Oct 22, 2012, at 7:44 PM, Peter DePasquale wrote:
>>>>>>> 
>>>>>>>> Yep, both in one jar (mine), with the two log4j2 jars in the
>/lib/ext
>>>>>>>> area.  Will have to work on the zip and get back to you....
>>>>>>>> 
>>>>>>>> On Mon, Oct 22, 2012 at 10:38 PM, Ralph Goers
>>>>>>>> <ra...@dslextreme.com> wrote:
>>>>>>>>> In theory, what you are describing should be working.  Are the
>two classes in one jar with Log4j in separate jars? Is it possible for
>you to provide a zip of your project with the two classes exactly as it
>is packaged?
>>>>>>>>> 
>>>>>>>>> Ralph
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> On Oct 22, 2012, at 5:51 PM, Peter DePasquale wrote:
>>>>>>>>> 
>>>>>>>>>> Ok, I'm new, and I'm stumped.  Here's my log4j2 config file:
>>>>>>>>>> 
>>>>>>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>>>>>>> <configuration status="debug">
>>>>>>>>>>  <appenders>
>>>>>>>>>>          <Console name="Console" target="SYSTEM_OUT">
>>>>>>>>>>                  <PatternLayout pattern="%d{HH:mm:ss} [%t]
>%-5level %logger{36} - %msg%n"/>
>>>>>>>>>>          </Console>
>>>>>>>>>> 
>>>>>>>>>>          <File name="DriversFile"
>fileName="trace-drivers.txt"
>>>>>>>>>> suppressExceptions="false" append="false">
>>>>>>>>>>                  <PatternLayout pattern="%d{yyyy-MM-dd
>HH:mm:ss} %p %C [%t] %m%n"/>
>>>>>>>>>>          </File>
>>>>>>>>>>  </appenders>
>>>>>>>>>> 
>>>>>>>>>>  <loggers>
>>>>>>>>>>          <logger name="org.comtor.drivers" level="trace"
>additivity="false">
>>>>>>>>>>                  <appender-ref ref="DriversFile"/>
>>>>>>>>>>          </logger>
>>>>>>>>>> 
>>>>>>>>>>          <root level="error">
>>>>>>>>>>                  <appender-ref ref="Console"/>
>>>>>>>>>>          </root>
>>>>>>>>>>  </loggers>
>>>>>>>>>> </configuration>
>>>>>>>>>> 
>>>>>>>>>> Note that the config status="debug". I have two classes that
>I'm
>>>>>>>>>> monkeying with to get Log4J2 working. They are:
>>>>>>>>>> 
>>>>>>>>>> org.comtor.drivers.Comtor, and
>>>>>>>>>> org.comtor.drivers.ComtorStandAlone
>>>>>>>>>> 
>>>>>>>>>> At this point, I'm only using a handful (and I mean small
>numbers
>>>>>>>>>> here) of .trace(), .entry(), and .exit() method calls.
>>>>>>>>>> 
>>>>>>>>>> If I do this in file #2 (ComtorStandAlone), I can get the
>tracing to
>>>>>>>>>> write to the file specified in the config file above (as well
>as DEBUG
>>>>>>>>>> statements from log4j2 on the console). Ok, cool. But when I
>add
>>>>>>>>>> logging to the first file (Comtor) thereby in theory logging
>from two
>>>>>>>>>> classes in the program, NOTHING happens. No config file
>logging to the
>>>>>>>>>> console, no output file, nothing.
>>>>>>>>>> 
>>>>>>>>>> Am I misunderstanding the capability to have the
>"org.comtor.drivers"
>>>>>>>>>> logger catch, process, and write to the same file? In fact,
>if I only
>>>>>>>>>> create the Logger object in the second file (private static
>Logger
>>>>>>>>>> logger = LogManager.getLogger(Comtor.class.getName());)
>without
>>>>>>>>>> attempting to call .trace(), .entry(), or .exit(), the
>problem
>>>>>>>>>> manifests itself (no output, no file, nothing).
>>>>>>>>>> 
>>>>>>>>>> I'd appreciate any insight here, as I'm really at a loss.
>Thanks.
>>>>>>>>>> 
>>>>>>>>>> --
>>>>>>>>>> Peter J. DePasquale, Ph.D.
>>>>>>>>>> Department of Computer Science
>>>>>>>>>> The College of New Jersey
>>>>>>>>>> (e) depasqua [at] tcnj [dot] edu
>>>>>>>>>> (p) 609-771-2806
>>>>>>>>>> (f) 609-637-5190
>>>>>>>>>> (o) Holman Hall - Room 238
>>>>>>>>>> (l) Holman Hall - Room 255
>>>>>>>>>> 
>>>>>>>>>>
>---------------------------------------------------------------------
>>>>>>>>>> To unsubscribe, e-mail:
>log4j-user-unsubscribe@logging.apache.org
>>>>>>>>>> For additional commands, e-mail:
>log4j-user-help@logging.apache.org
>>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>>
>---------------------------------------------------------------------
>>>>>>>>> To unsubscribe, e-mail:
>log4j-user-unsubscribe@logging.apache.org
>>>>>>>>> For additional commands, e-mail:
>log4j-user-help@logging.apache.org
>>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>>> --
>>>>>>>> Peter J. DePasquale, Ph.D.
>>>>>>>> Department of Computer Science
>>>>>>>> The College of New Jersey
>>>>>>>> (e) depasqua [at] tcnj [dot] edu
>>>>>>>> (p) 609-771-2806
>>>>>>>> (f) 609-637-5190
>>>>>>>> (o) Holman Hall - Room 238
>>>>>>>> (l) Holman Hall - Room 255
>>>>>>>> 
>>>>>>>>
>---------------------------------------------------------------------
>>>>>>>> To unsubscribe, e-mail:
>log4j-user-unsubscribe@logging.apache.org
>>>>>>>> For additional commands, e-mail:
>log4j-user-help@logging.apache.org
>>>>>>>> 
>>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>>
>---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>>>>> For additional commands, e-mail:
>log4j-user-help@logging.apache.org
>>>>> 
>>>>> 
>>>>> 
>>>>> --
>>>>> Peter J. DePasquale, Ph.D.
>>>>> Department of Computer Science
>>>>> The College of New Jersey
>>>>> (e) depasqua [at] tcnj [dot] edu
>>>>> (p) 609-771-2806
>>>>> (f) 609-637-5190
>>>>> (o) Holman Hall - Room 238
>>>>> (l) Holman Hall - Room 255
>>>>> 
>>>>>
>---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>>>> For additional commands, e-mail:
>log4j-user-help@logging.apache.org
>>>>> 
>>>> 
>>> 
>>> 
>>>
>---------------------------------------------------------------------
>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>> 
>> 
>> 
>> 
>> -- 
>> Peter J. DePasquale, Ph.D.
>> Department of Computer Science
>> The College of New Jersey
>> (e) depasqua [at] tcnj [dot] edu
>> (p) 609-771-2806
>> (f) 609-637-5190
>> (o) Holman Hall - Room 238
>> (l) Holman Hall - Room 255
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>> 
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>For additional commands, e-mail: log4j-user-help@logging.apache.org

-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

Re: Two classes, logging to the same file...

Posted by "Peter J. DePasquale" <pe...@gmail.com>.
No more unzipping/rejarring. Will try to see utility there is a difference in behavior when they are in the same base dir.

Ralph Goers <ra...@dslextreme.com> wrote:

>BTW - I just want to make sure that you are aware that instead of
>unzipping all your jars and rezipping into one new jar that another
>alternative you have is to just place all the jars in one directory. 
>Then, instead of placing the log4j jars in lib/ext or combining them
>with your classes you would do:
>
>java -cp "lib/*:target/classes" com.test.App
>
>Ralph
>
>
>On Oct 23, 2012, at 11:39 AM, Peter DePasquale wrote:
>
>> OK, I'll try as you suggested when I can... I'm leaving to head to a
>> talk at Google in NYC, so this may not happen for a day or two...
>> trying to avoid shipping you code, but if we have to I will.
>> 
>> Thanks for the help!
>> 
>> On Tue, Oct 23, 2012 at 2:36 PM, Ralph Goers
><ra...@dslextreme.com> wrote:
>>> OK - I tried my theory and didn't have any problems.
>>> 
>>> Ralph
>>> 
>>> On Oct 23, 2012, at 10:59 AM, Ralph Goers wrote:
>>> 
>>>> That is good to know. However, your test has spawned a suspicion
>that the problem may be related to one class starting with the name of
>the other.  Try renaming Comtor or ComtorStandAlone so they don't
>overlap and see if the problem goes away.  If it does then it is a bug
>in Log4j.
>>>> 
>>>> I'll try modifying my test to emulate that and see if I get the
>problem.
>>>> 
>>>> Ralph
>>>> 
>>>> 
>>>> On Oct 23, 2012, at 10:35 AM, Peter DePasquale wrote:
>>>> 
>>>>> So I was able to download this and replicate your results.
>>>>> 
>>>>> I've adjusted my logger config to account for other classes in a
>>>>> different package (org.comtor rather than org.comtor.drivers) and
>that
>>>>> works. Thus, my issue apparently is specific to this particular
>one
>>>>> class. Debugging continues as I have the time.
>>>>> 
>>>>> On Tue, Oct 23, 2012 at 3:47 AM, Ralph Goers
><ra...@dslextreme.com> wrote:
>>>>>> I copied the log4j api and core jars into
>/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/lib/ext/
>on my Mac.  I found a project I had used before that had two classes
>and modified it slightly for this test.  I ran the test and got the
>following output (which will probably look terrible after it is
>emailed).   The log4j2.xml file was in the classes directory of my
>project so it could be found in the classpath.  I will attempt to add
>the project zip to the email but I don't know if this list accepts
>attachments.  I also got an output file which should be in the "target"
>directory in the zip.
>>>>>> 
>>>>>> Ralph
>>>>>> 
>>>>>> java -cp /Users/rgoers/test/log4jtest/test/target/classes
>com.test.App
>>>>>> 2012-10-23 00:44:26,908 DEBUG Generated plugins in 0.000012000
>seconds
>>>>>> 2012-10-23 00:44:26,916 DEBUG Calling createFilter on class
>org.apache.logging.log4j.core.filter.ThresholdFilter for element
>ThresholdFilter with params(level="ERROR", onMatch="ACCEPT",
>onMismatch="DENY")
>>>>>> 2012-10-23 00:44:26,920 DEBUG Calling createLayout on class
>org.apache.logging.log4j.core.layout.PatternLayout for element
>PatternLayout with params(pattern="%d{HH:mm:ss.SSS} %-5level %class{36}
>%L %M - %msg%xEx%n", Configuration, null, charset="null")
>>>>>> 2012-10-23 00:44:26,920 DEBUG Generated plugins in 0.000010000
>seconds
>>>>>> 2012-10-23 00:44:26,922 DEBUG Calling createAppender on class
>org.apache.logging.log4j.core.appender.ConsoleAppender for element
>Console with params(PatternLayout(%d{HH:mm:ss.SSS} %-5level %class{36}
>%L %M - %msg%xEx%n), ThresholdFilter(ERROR), target="SYSTEM_OUT",
>name="Console", suppressExceptions="null")
>>>>>> 2012-10-23 00:44:26,923 DEBUG Calling createLayout on class
>org.apache.logging.log4j.core.layout.PatternLayout for element
>PatternLayout with params(pattern="%d{HH:mm:ss.SSS} %-5level %class{36}
>%L %M - %msg%xEx%n", Configuration, null, charset="null")
>>>>>> 2012-10-23 00:44:26,925 DEBUG Calling createAppender on class
>org.apache.logging.log4j.core.appender.FileAppender for element File
>with params(fileName="target/test.log", append="false", locking="null",
>name="log", immediateFlush="null", suppressExceptions="null",
>bufferedIO="null", PatternLayout(%d{HH:mm:ss.SSS} %-5level %class{36}
>%L %M - %msg%xEx%n), null)
>>>>>> 2012-10-23 00:44:26,943 DEBUG Starting FileManager
>target/test.log
>>>>>> 2012-10-23 00:44:26,943 DEBUG Calling createAppenders on class
>org.apache.logging.log4j.core.config.plugins.AppendersPlugin for
>element appenders with params(appenders={Console, log})
>>>>>> 2012-10-23 00:44:26,944 DEBUG Generated plugins in 0.000016000
>seconds
>>>>>> 2012-10-23 00:44:26,945 DEBUG Calling createAppenderRef on class
>org.apache.logging.log4j.core.config.AppenderRef for element
>appender-ref with params(ref="log", level="null", null)
>>>>>> 2012-10-23 00:44:26,946 DEBUG Calling createLogger on class
>org.apache.logging.log4j.core.config.LoggerConfig for element logger
>with params(additivity="false", level="trace", name="com.test",
>appender-ref={org.apache.logging.log4j.core.config.AppenderRef@44a613f8},
>properties={}, Configuration, null)
>>>>>> 2012-10-23 00:44:26,947 DEBUG Calling createAppenderRef on class
>org.apache.logging.log4j.core.config.AppenderRef for element
>appender-ref with params(ref="Console", level="null", null)
>>>>>> 2012-10-23 00:44:26,948 DEBUG Calling createLogger on class
>org.apache.logging.log4j.core.config.LoggerConfig$RootLogger for
>element root with params(additivity="null", level="debug",
>appender-ref={org.apache.logging.log4j.core.config.AppenderRef@736921fd},
>properties={}, Configuration, null)
>>>>>> 2012-10-23 00:44:26,949 DEBUG Calling createLoggers on class
>org.apache.logging.log4j.core.config.plugins.LoggersPlugin for element
>loggers with params(loggers={com.test, root})
>>>>>> 2012-10-23 00:44:26,950 DEBUG Reconfiguration completed
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> On Oct 22, 2012, at 10:02 PM, Ralph Goers wrote:
>>>>>> 
>>>>>>> OK - I haven't tried installing into lib/ext. I will see if I
>can create a couple of classes to emulate what you are describing until
>you can get me a zip. I assume one or both of these has a main?  Where
>did you place log4j2.xml?
>>>>>>> 
>>>>>>> Ralph
>>>>>>> 
>>>>>>> On Oct 22, 2012, at 7:44 PM, Peter DePasquale wrote:
>>>>>>> 
>>>>>>>> Yep, both in one jar (mine), with the two log4j2 jars in the
>/lib/ext
>>>>>>>> area.  Will have to work on the zip and get back to you....
>>>>>>>> 
>>>>>>>> On Mon, Oct 22, 2012 at 10:38 PM, Ralph Goers
>>>>>>>> <ra...@dslextreme.com> wrote:
>>>>>>>>> In theory, what you are describing should be working.  Are the
>two classes in one jar with Log4j in separate jars? Is it possible for
>you to provide a zip of your project with the two classes exactly as it
>is packaged?
>>>>>>>>> 
>>>>>>>>> Ralph
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> On Oct 22, 2012, at 5:51 PM, Peter DePasquale wrote:
>>>>>>>>> 
>>>>>>>>>> Ok, I'm new, and I'm stumped.  Here's my log4j2 config file:
>>>>>>>>>> 
>>>>>>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>>>>>>> <configuration status="debug">
>>>>>>>>>>  <appenders>
>>>>>>>>>>          <Console name="Console" target="SYSTEM_OUT">
>>>>>>>>>>                  <PatternLayout pattern="%d{HH:mm:ss} [%t]
>%-5level %logger{36} - %msg%n"/>
>>>>>>>>>>          </Console>
>>>>>>>>>> 
>>>>>>>>>>          <File name="DriversFile"
>fileName="trace-drivers.txt"
>>>>>>>>>> suppressExceptions="false" append="false">
>>>>>>>>>>                  <PatternLayout pattern="%d{yyyy-MM-dd
>HH:mm:ss} %p %C [%t] %m%n"/>
>>>>>>>>>>          </File>
>>>>>>>>>>  </appenders>
>>>>>>>>>> 
>>>>>>>>>>  <loggers>
>>>>>>>>>>          <logger name="org.comtor.drivers" level="trace"
>additivity="false">
>>>>>>>>>>                  <appender-ref ref="DriversFile"/>
>>>>>>>>>>          </logger>
>>>>>>>>>> 
>>>>>>>>>>          <root level="error">
>>>>>>>>>>                  <appender-ref ref="Console"/>
>>>>>>>>>>          </root>
>>>>>>>>>>  </loggers>
>>>>>>>>>> </configuration>
>>>>>>>>>> 
>>>>>>>>>> Note that the config status="debug". I have two classes that
>I'm
>>>>>>>>>> monkeying with to get Log4J2 working. They are:
>>>>>>>>>> 
>>>>>>>>>> org.comtor.drivers.Comtor, and
>>>>>>>>>> org.comtor.drivers.ComtorStandAlone
>>>>>>>>>> 
>>>>>>>>>> At this point, I'm only using a handful (and I mean small
>numbers
>>>>>>>>>> here) of .trace(), .entry(), and .exit() method calls.
>>>>>>>>>> 
>>>>>>>>>> If I do this in file #2 (ComtorStandAlone), I can get the
>tracing to
>>>>>>>>>> write to the file specified in the config file above (as well
>as DEBUG
>>>>>>>>>> statements from log4j2 on the console). Ok, cool. But when I
>add
>>>>>>>>>> logging to the first file (Comtor) thereby in theory logging
>from two
>>>>>>>>>> classes in the program, NOTHING happens. No config file
>logging to the
>>>>>>>>>> console, no output file, nothing.
>>>>>>>>>> 
>>>>>>>>>> Am I misunderstanding the capability to have the
>"org.comtor.drivers"
>>>>>>>>>> logger catch, process, and write to the same file? In fact,
>if I only
>>>>>>>>>> create the Logger object in the second file (private static
>Logger
>>>>>>>>>> logger = LogManager.getLogger(Comtor.class.getName());)
>without
>>>>>>>>>> attempting to call .trace(), .entry(), or .exit(), the
>problem
>>>>>>>>>> manifests itself (no output, no file, nothing).
>>>>>>>>>> 
>>>>>>>>>> I'd appreciate any insight here, as I'm really at a loss.
>Thanks.
>>>>>>>>>> 
>>>>>>>>>> --
>>>>>>>>>> Peter J. DePasquale, Ph.D.
>>>>>>>>>> Department of Computer Science
>>>>>>>>>> The College of New Jersey
>>>>>>>>>> (e) depasqua [at] tcnj [dot] edu
>>>>>>>>>> (p) 609-771-2806
>>>>>>>>>> (f) 609-637-5190
>>>>>>>>>> (o) Holman Hall - Room 238
>>>>>>>>>> (l) Holman Hall - Room 255
>>>>>>>>>> 
>>>>>>>>>>
>---------------------------------------------------------------------
>>>>>>>>>> To unsubscribe, e-mail:
>log4j-user-unsubscribe@logging.apache.org
>>>>>>>>>> For additional commands, e-mail:
>log4j-user-help@logging.apache.org
>>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>>
>---------------------------------------------------------------------
>>>>>>>>> To unsubscribe, e-mail:
>log4j-user-unsubscribe@logging.apache.org
>>>>>>>>> For additional commands, e-mail:
>log4j-user-help@logging.apache.org
>>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>>> --
>>>>>>>> Peter J. DePasquale, Ph.D.
>>>>>>>> Department of Computer Science
>>>>>>>> The College of New Jersey
>>>>>>>> (e) depasqua [at] tcnj [dot] edu
>>>>>>>> (p) 609-771-2806
>>>>>>>> (f) 609-637-5190
>>>>>>>> (o) Holman Hall - Room 238
>>>>>>>> (l) Holman Hall - Room 255
>>>>>>>> 
>>>>>>>>
>---------------------------------------------------------------------
>>>>>>>> To unsubscribe, e-mail:
>log4j-user-unsubscribe@logging.apache.org
>>>>>>>> For additional commands, e-mail:
>log4j-user-help@logging.apache.org
>>>>>>>> 
>>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>>
>---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>>>>> For additional commands, e-mail:
>log4j-user-help@logging.apache.org
>>>>> 
>>>>> 
>>>>> 
>>>>> --
>>>>> Peter J. DePasquale, Ph.D.
>>>>> Department of Computer Science
>>>>> The College of New Jersey
>>>>> (e) depasqua [at] tcnj [dot] edu
>>>>> (p) 609-771-2806
>>>>> (f) 609-637-5190
>>>>> (o) Holman Hall - Room 238
>>>>> (l) Holman Hall - Room 255
>>>>> 
>>>>>
>---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>>>> For additional commands, e-mail:
>log4j-user-help@logging.apache.org
>>>>> 
>>>> 
>>> 
>>> 
>>>
>---------------------------------------------------------------------
>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>> 
>> 
>> 
>> 
>> -- 
>> Peter J. DePasquale, Ph.D.
>> Department of Computer Science
>> The College of New Jersey
>> (e) depasqua [at] tcnj [dot] edu
>> (p) 609-771-2806
>> (f) 609-637-5190
>> (o) Holman Hall - Room 238
>> (l) Holman Hall - Room 255
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>> 
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>For additional commands, e-mail: log4j-user-help@logging.apache.org

-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

Re: Two classes, logging to the same file...

Posted by Ralph Goers <ra...@dslextreme.com>.
BTW - I just want to make sure that you are aware that instead of unzipping all your jars and rezipping into one new jar that another alternative you have is to just place all the jars in one directory.  Then, instead of placing the log4j jars in lib/ext or combining them with your classes you would do:

java -cp "lib/*:target/classes" com.test.App

Ralph


On Oct 23, 2012, at 11:39 AM, Peter DePasquale wrote:

> OK, I'll try as you suggested when I can... I'm leaving to head to a
> talk at Google in NYC, so this may not happen for a day or two...
> trying to avoid shipping you code, but if we have to I will.
> 
> Thanks for the help!
> 
> On Tue, Oct 23, 2012 at 2:36 PM, Ralph Goers <ra...@dslextreme.com> wrote:
>> OK - I tried my theory and didn't have any problems.
>> 
>> Ralph
>> 
>> On Oct 23, 2012, at 10:59 AM, Ralph Goers wrote:
>> 
>>> That is good to know. However, your test has spawned a suspicion that the problem may be related to one class starting with the name of the other.  Try renaming Comtor or ComtorStandAlone so they don't overlap and see if the problem goes away.  If it does then it is a bug in Log4j.
>>> 
>>> I'll try modifying my test to emulate that and see if I get the problem.
>>> 
>>> Ralph
>>> 
>>> 
>>> On Oct 23, 2012, at 10:35 AM, Peter DePasquale wrote:
>>> 
>>>> So I was able to download this and replicate your results.
>>>> 
>>>> I've adjusted my logger config to account for other classes in a
>>>> different package (org.comtor rather than org.comtor.drivers) and that
>>>> works. Thus, my issue apparently is specific to this particular one
>>>> class. Debugging continues as I have the time.
>>>> 
>>>> On Tue, Oct 23, 2012 at 3:47 AM, Ralph Goers <ra...@dslextreme.com> wrote:
>>>>> I copied the log4j api and core jars into /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/lib/ext/ on my Mac.  I found a project I had used before that had two classes and modified it slightly for this test.  I ran the test and got the following output (which will probably look terrible after it is emailed).   The log4j2.xml file was in the classes directory of my project so it could be found in the classpath.  I will attempt to add the project zip to the email but I don't know if this list accepts attachments.  I also got an output file which should be in the "target" directory in the zip.
>>>>> 
>>>>> Ralph
>>>>> 
>>>>> java -cp /Users/rgoers/test/log4jtest/test/target/classes com.test.App
>>>>> 2012-10-23 00:44:26,908 DEBUG Generated plugins in 0.000012000 seconds
>>>>> 2012-10-23 00:44:26,916 DEBUG Calling createFilter on class org.apache.logging.log4j.core.filter.ThresholdFilter for element ThresholdFilter with params(level="ERROR", onMatch="ACCEPT", onMismatch="DENY")
>>>>> 2012-10-23 00:44:26,920 DEBUG Calling createLayout on class org.apache.logging.log4j.core.layout.PatternLayout for element PatternLayout with params(pattern="%d{HH:mm:ss.SSS} %-5level %class{36} %L %M - %msg%xEx%n", Configuration, null, charset="null")
>>>>> 2012-10-23 00:44:26,920 DEBUG Generated plugins in 0.000010000 seconds
>>>>> 2012-10-23 00:44:26,922 DEBUG Calling createAppender on class org.apache.logging.log4j.core.appender.ConsoleAppender for element Console with params(PatternLayout(%d{HH:mm:ss.SSS} %-5level %class{36} %L %M - %msg%xEx%n), ThresholdFilter(ERROR), target="SYSTEM_OUT", name="Console", suppressExceptions="null")
>>>>> 2012-10-23 00:44:26,923 DEBUG Calling createLayout on class org.apache.logging.log4j.core.layout.PatternLayout for element PatternLayout with params(pattern="%d{HH:mm:ss.SSS} %-5level %class{36} %L %M - %msg%xEx%n", Configuration, null, charset="null")
>>>>> 2012-10-23 00:44:26,925 DEBUG Calling createAppender on class org.apache.logging.log4j.core.appender.FileAppender for element File with params(fileName="target/test.log", append="false", locking="null", name="log", immediateFlush="null", suppressExceptions="null", bufferedIO="null", PatternLayout(%d{HH:mm:ss.SSS} %-5level %class{36} %L %M - %msg%xEx%n), null)
>>>>> 2012-10-23 00:44:26,943 DEBUG Starting FileManager target/test.log
>>>>> 2012-10-23 00:44:26,943 DEBUG Calling createAppenders on class org.apache.logging.log4j.core.config.plugins.AppendersPlugin for element appenders with params(appenders={Console, log})
>>>>> 2012-10-23 00:44:26,944 DEBUG Generated plugins in 0.000016000 seconds
>>>>> 2012-10-23 00:44:26,945 DEBUG Calling createAppenderRef on class org.apache.logging.log4j.core.config.AppenderRef for element appender-ref with params(ref="log", level="null", null)
>>>>> 2012-10-23 00:44:26,946 DEBUG Calling createLogger on class org.apache.logging.log4j.core.config.LoggerConfig for element logger with params(additivity="false", level="trace", name="com.test", appender-ref={org.apache.logging.log4j.core.config.AppenderRef@44a613f8}, properties={}, Configuration, null)
>>>>> 2012-10-23 00:44:26,947 DEBUG Calling createAppenderRef on class org.apache.logging.log4j.core.config.AppenderRef for element appender-ref with params(ref="Console", level="null", null)
>>>>> 2012-10-23 00:44:26,948 DEBUG Calling createLogger on class org.apache.logging.log4j.core.config.LoggerConfig$RootLogger for element root with params(additivity="null", level="debug", appender-ref={org.apache.logging.log4j.core.config.AppenderRef@736921fd}, properties={}, Configuration, null)
>>>>> 2012-10-23 00:44:26,949 DEBUG Calling createLoggers on class org.apache.logging.log4j.core.config.plugins.LoggersPlugin for element loggers with params(loggers={com.test, root})
>>>>> 2012-10-23 00:44:26,950 DEBUG Reconfiguration completed
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> On Oct 22, 2012, at 10:02 PM, Ralph Goers wrote:
>>>>> 
>>>>>> OK - I haven't tried installing into lib/ext. I will see if I can create a couple of classes to emulate what you are describing until you can get me a zip. I assume one or both of these has a main?  Where did you place log4j2.xml?
>>>>>> 
>>>>>> Ralph
>>>>>> 
>>>>>> On Oct 22, 2012, at 7:44 PM, Peter DePasquale wrote:
>>>>>> 
>>>>>>> Yep, both in one jar (mine), with the two log4j2 jars in the /lib/ext
>>>>>>> area.  Will have to work on the zip and get back to you....
>>>>>>> 
>>>>>>> On Mon, Oct 22, 2012 at 10:38 PM, Ralph Goers
>>>>>>> <ra...@dslextreme.com> wrote:
>>>>>>>> In theory, what you are describing should be working.  Are the two classes in one jar with Log4j in separate jars? Is it possible for you to provide a zip of your project with the two classes exactly as it is packaged?
>>>>>>>> 
>>>>>>>> Ralph
>>>>>>>> 
>>>>>>>> 
>>>>>>>> On Oct 22, 2012, at 5:51 PM, Peter DePasquale wrote:
>>>>>>>> 
>>>>>>>>> Ok, I'm new, and I'm stumped.  Here's my log4j2 config file:
>>>>>>>>> 
>>>>>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>>>>>> <configuration status="debug">
>>>>>>>>>  <appenders>
>>>>>>>>>          <Console name="Console" target="SYSTEM_OUT">
>>>>>>>>>                  <PatternLayout pattern="%d{HH:mm:ss} [%t] %-5level %logger{36} - %msg%n"/>
>>>>>>>>>          </Console>
>>>>>>>>> 
>>>>>>>>>          <File name="DriversFile" fileName="trace-drivers.txt"
>>>>>>>>> suppressExceptions="false" append="false">
>>>>>>>>>                  <PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} %p %C [%t] %m%n"/>
>>>>>>>>>          </File>
>>>>>>>>>  </appenders>
>>>>>>>>> 
>>>>>>>>>  <loggers>
>>>>>>>>>          <logger name="org.comtor.drivers" level="trace" additivity="false">
>>>>>>>>>                  <appender-ref ref="DriversFile"/>
>>>>>>>>>          </logger>
>>>>>>>>> 
>>>>>>>>>          <root level="error">
>>>>>>>>>                  <appender-ref ref="Console"/>
>>>>>>>>>          </root>
>>>>>>>>>  </loggers>
>>>>>>>>> </configuration>
>>>>>>>>> 
>>>>>>>>> Note that the config status="debug". I have two classes that I'm
>>>>>>>>> monkeying with to get Log4J2 working. They are:
>>>>>>>>> 
>>>>>>>>> org.comtor.drivers.Comtor, and
>>>>>>>>> org.comtor.drivers.ComtorStandAlone
>>>>>>>>> 
>>>>>>>>> At this point, I'm only using a handful (and I mean small numbers
>>>>>>>>> here) of .trace(), .entry(), and .exit() method calls.
>>>>>>>>> 
>>>>>>>>> If I do this in file #2 (ComtorStandAlone), I can get the tracing to
>>>>>>>>> write to the file specified in the config file above (as well as DEBUG
>>>>>>>>> statements from log4j2 on the console). Ok, cool. But when I add
>>>>>>>>> logging to the first file (Comtor) thereby in theory logging from two
>>>>>>>>> classes in the program, NOTHING happens. No config file logging to the
>>>>>>>>> console, no output file, nothing.
>>>>>>>>> 
>>>>>>>>> Am I misunderstanding the capability to have the "org.comtor.drivers"
>>>>>>>>> logger catch, process, and write to the same file? In fact, if I only
>>>>>>>>> create the Logger object in the second file (private static Logger
>>>>>>>>> logger = LogManager.getLogger(Comtor.class.getName());) without
>>>>>>>>> attempting to call .trace(), .entry(), or .exit(), the problem
>>>>>>>>> manifests itself (no output, no file, nothing).
>>>>>>>>> 
>>>>>>>>> I'd appreciate any insight here, as I'm really at a loss. Thanks.
>>>>>>>>> 
>>>>>>>>> --
>>>>>>>>> Peter J. DePasquale, Ph.D.
>>>>>>>>> Department of Computer Science
>>>>>>>>> The College of New Jersey
>>>>>>>>> (e) depasqua [at] tcnj [dot] edu
>>>>>>>>> (p) 609-771-2806
>>>>>>>>> (f) 609-637-5190
>>>>>>>>> (o) Holman Hall - Room 238
>>>>>>>>> (l) Holman Hall - Room 255
>>>>>>>>> 
>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>>>>>>>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>>> ---------------------------------------------------------------------
>>>>>>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>>>>>>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> --
>>>>>>> Peter J. DePasquale, Ph.D.
>>>>>>> Department of Computer Science
>>>>>>> The College of New Jersey
>>>>>>> (e) depasqua [at] tcnj [dot] edu
>>>>>>> (p) 609-771-2806
>>>>>>> (f) 609-637-5190
>>>>>>> (o) Holman Hall - Room 238
>>>>>>> (l) Holman Hall - Room 255
>>>>>>> 
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>>>>>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>>>>>> 
>>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>>>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>>> 
>>>> 
>>>> 
>>>> --
>>>> Peter J. DePasquale, Ph.D.
>>>> Department of Computer Science
>>>> The College of New Jersey
>>>> (e) depasqua [at] tcnj [dot] edu
>>>> (p) 609-771-2806
>>>> (f) 609-637-5190
>>>> (o) Holman Hall - Room 238
>>>> (l) Holman Hall - Room 255
>>>> 
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>>> 
>>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>> 
> 
> 
> 
> -- 
> Peter J. DePasquale, Ph.D.
> Department of Computer Science
> The College of New Jersey
> (e) depasqua [at] tcnj [dot] edu
> (p) 609-771-2806
> (f) 609-637-5190
> (o) Holman Hall - Room 238
> (l) Holman Hall - Room 255
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: Two classes, logging to the same file...

Posted by Peter DePasquale <pe...@gmail.com>.
OK, I'll try as you suggested when I can... I'm leaving to head to a
talk at Google in NYC, so this may not happen for a day or two...
trying to avoid shipping you code, but if we have to I will.

Thanks for the help!

On Tue, Oct 23, 2012 at 2:36 PM, Ralph Goers <ra...@dslextreme.com> wrote:
> OK - I tried my theory and didn't have any problems.
>
> Ralph
>
> On Oct 23, 2012, at 10:59 AM, Ralph Goers wrote:
>
>> That is good to know. However, your test has spawned a suspicion that the problem may be related to one class starting with the name of the other.  Try renaming Comtor or ComtorStandAlone so they don't overlap and see if the problem goes away.  If it does then it is a bug in Log4j.
>>
>> I'll try modifying my test to emulate that and see if I get the problem.
>>
>> Ralph
>>
>>
>> On Oct 23, 2012, at 10:35 AM, Peter DePasquale wrote:
>>
>>> So I was able to download this and replicate your results.
>>>
>>> I've adjusted my logger config to account for other classes in a
>>> different package (org.comtor rather than org.comtor.drivers) and that
>>> works. Thus, my issue apparently is specific to this particular one
>>> class. Debugging continues as I have the time.
>>>
>>> On Tue, Oct 23, 2012 at 3:47 AM, Ralph Goers <ra...@dslextreme.com> wrote:
>>>> I copied the log4j api and core jars into /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/lib/ext/ on my Mac.  I found a project I had used before that had two classes and modified it slightly for this test.  I ran the test and got the following output (which will probably look terrible after it is emailed).   The log4j2.xml file was in the classes directory of my project so it could be found in the classpath.  I will attempt to add the project zip to the email but I don't know if this list accepts attachments.  I also got an output file which should be in the "target" directory in the zip.
>>>>
>>>> Ralph
>>>>
>>>> java -cp /Users/rgoers/test/log4jtest/test/target/classes com.test.App
>>>> 2012-10-23 00:44:26,908 DEBUG Generated plugins in 0.000012000 seconds
>>>> 2012-10-23 00:44:26,916 DEBUG Calling createFilter on class org.apache.logging.log4j.core.filter.ThresholdFilter for element ThresholdFilter with params(level="ERROR", onMatch="ACCEPT", onMismatch="DENY")
>>>> 2012-10-23 00:44:26,920 DEBUG Calling createLayout on class org.apache.logging.log4j.core.layout.PatternLayout for element PatternLayout with params(pattern="%d{HH:mm:ss.SSS} %-5level %class{36} %L %M - %msg%xEx%n", Configuration, null, charset="null")
>>>> 2012-10-23 00:44:26,920 DEBUG Generated plugins in 0.000010000 seconds
>>>> 2012-10-23 00:44:26,922 DEBUG Calling createAppender on class org.apache.logging.log4j.core.appender.ConsoleAppender for element Console with params(PatternLayout(%d{HH:mm:ss.SSS} %-5level %class{36} %L %M - %msg%xEx%n), ThresholdFilter(ERROR), target="SYSTEM_OUT", name="Console", suppressExceptions="null")
>>>> 2012-10-23 00:44:26,923 DEBUG Calling createLayout on class org.apache.logging.log4j.core.layout.PatternLayout for element PatternLayout with params(pattern="%d{HH:mm:ss.SSS} %-5level %class{36} %L %M - %msg%xEx%n", Configuration, null, charset="null")
>>>> 2012-10-23 00:44:26,925 DEBUG Calling createAppender on class org.apache.logging.log4j.core.appender.FileAppender for element File with params(fileName="target/test.log", append="false", locking="null", name="log", immediateFlush="null", suppressExceptions="null", bufferedIO="null", PatternLayout(%d{HH:mm:ss.SSS} %-5level %class{36} %L %M - %msg%xEx%n), null)
>>>> 2012-10-23 00:44:26,943 DEBUG Starting FileManager target/test.log
>>>> 2012-10-23 00:44:26,943 DEBUG Calling createAppenders on class org.apache.logging.log4j.core.config.plugins.AppendersPlugin for element appenders with params(appenders={Console, log})
>>>> 2012-10-23 00:44:26,944 DEBUG Generated plugins in 0.000016000 seconds
>>>> 2012-10-23 00:44:26,945 DEBUG Calling createAppenderRef on class org.apache.logging.log4j.core.config.AppenderRef for element appender-ref with params(ref="log", level="null", null)
>>>> 2012-10-23 00:44:26,946 DEBUG Calling createLogger on class org.apache.logging.log4j.core.config.LoggerConfig for element logger with params(additivity="false", level="trace", name="com.test", appender-ref={org.apache.logging.log4j.core.config.AppenderRef@44a613f8}, properties={}, Configuration, null)
>>>> 2012-10-23 00:44:26,947 DEBUG Calling createAppenderRef on class org.apache.logging.log4j.core.config.AppenderRef for element appender-ref with params(ref="Console", level="null", null)
>>>> 2012-10-23 00:44:26,948 DEBUG Calling createLogger on class org.apache.logging.log4j.core.config.LoggerConfig$RootLogger for element root with params(additivity="null", level="debug", appender-ref={org.apache.logging.log4j.core.config.AppenderRef@736921fd}, properties={}, Configuration, null)
>>>> 2012-10-23 00:44:26,949 DEBUG Calling createLoggers on class org.apache.logging.log4j.core.config.plugins.LoggersPlugin for element loggers with params(loggers={com.test, root})
>>>> 2012-10-23 00:44:26,950 DEBUG Reconfiguration completed
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On Oct 22, 2012, at 10:02 PM, Ralph Goers wrote:
>>>>
>>>>> OK - I haven't tried installing into lib/ext. I will see if I can create a couple of classes to emulate what you are describing until you can get me a zip. I assume one or both of these has a main?  Where did you place log4j2.xml?
>>>>>
>>>>> Ralph
>>>>>
>>>>> On Oct 22, 2012, at 7:44 PM, Peter DePasquale wrote:
>>>>>
>>>>>> Yep, both in one jar (mine), with the two log4j2 jars in the /lib/ext
>>>>>> area.  Will have to work on the zip and get back to you....
>>>>>>
>>>>>> On Mon, Oct 22, 2012 at 10:38 PM, Ralph Goers
>>>>>> <ra...@dslextreme.com> wrote:
>>>>>>> In theory, what you are describing should be working.  Are the two classes in one jar with Log4j in separate jars? Is it possible for you to provide a zip of your project with the two classes exactly as it is packaged?
>>>>>>>
>>>>>>> Ralph
>>>>>>>
>>>>>>>
>>>>>>> On Oct 22, 2012, at 5:51 PM, Peter DePasquale wrote:
>>>>>>>
>>>>>>>> Ok, I'm new, and I'm stumped.  Here's my log4j2 config file:
>>>>>>>>
>>>>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>>>>> <configuration status="debug">
>>>>>>>>   <appenders>
>>>>>>>>           <Console name="Console" target="SYSTEM_OUT">
>>>>>>>>                   <PatternLayout pattern="%d{HH:mm:ss} [%t] %-5level %logger{36} - %msg%n"/>
>>>>>>>>           </Console>
>>>>>>>>
>>>>>>>>           <File name="DriversFile" fileName="trace-drivers.txt"
>>>>>>>> suppressExceptions="false" append="false">
>>>>>>>>                   <PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} %p %C [%t] %m%n"/>
>>>>>>>>           </File>
>>>>>>>>   </appenders>
>>>>>>>>
>>>>>>>>   <loggers>
>>>>>>>>           <logger name="org.comtor.drivers" level="trace" additivity="false">
>>>>>>>>                   <appender-ref ref="DriversFile"/>
>>>>>>>>           </logger>
>>>>>>>>
>>>>>>>>           <root level="error">
>>>>>>>>                   <appender-ref ref="Console"/>
>>>>>>>>           </root>
>>>>>>>>   </loggers>
>>>>>>>> </configuration>
>>>>>>>>
>>>>>>>> Note that the config status="debug". I have two classes that I'm
>>>>>>>> monkeying with to get Log4J2 working. They are:
>>>>>>>>
>>>>>>>> org.comtor.drivers.Comtor, and
>>>>>>>> org.comtor.drivers.ComtorStandAlone
>>>>>>>>
>>>>>>>> At this point, I'm only using a handful (and I mean small numbers
>>>>>>>> here) of .trace(), .entry(), and .exit() method calls.
>>>>>>>>
>>>>>>>> If I do this in file #2 (ComtorStandAlone), I can get the tracing to
>>>>>>>> write to the file specified in the config file above (as well as DEBUG
>>>>>>>> statements from log4j2 on the console). Ok, cool. But when I add
>>>>>>>> logging to the first file (Comtor) thereby in theory logging from two
>>>>>>>> classes in the program, NOTHING happens. No config file logging to the
>>>>>>>> console, no output file, nothing.
>>>>>>>>
>>>>>>>> Am I misunderstanding the capability to have the "org.comtor.drivers"
>>>>>>>> logger catch, process, and write to the same file? In fact, if I only
>>>>>>>> create the Logger object in the second file (private static Logger
>>>>>>>> logger = LogManager.getLogger(Comtor.class.getName());) without
>>>>>>>> attempting to call .trace(), .entry(), or .exit(), the problem
>>>>>>>> manifests itself (no output, no file, nothing).
>>>>>>>>
>>>>>>>> I'd appreciate any insight here, as I'm really at a loss. Thanks.
>>>>>>>>
>>>>>>>> --
>>>>>>>> Peter J. DePasquale, Ph.D.
>>>>>>>> Department of Computer Science
>>>>>>>> The College of New Jersey
>>>>>>>> (e) depasqua [at] tcnj [dot] edu
>>>>>>>> (p) 609-771-2806
>>>>>>>> (f) 609-637-5190
>>>>>>>> (o) Holman Hall - Room 238
>>>>>>>> (l) Holman Hall - Room 255
>>>>>>>>
>>>>>>>> ---------------------------------------------------------------------
>>>>>>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>>>>>>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>>>>>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Peter J. DePasquale, Ph.D.
>>>>>> Department of Computer Science
>>>>>> The College of New Jersey
>>>>>> (e) depasqua [at] tcnj [dot] edu
>>>>>> (p) 609-771-2806
>>>>>> (f) 609-637-5190
>>>>>> (o) Holman Hall - Room 238
>>>>>> (l) Holman Hall - Room 255
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>>>>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>>
>>>
>>>
>>> --
>>> Peter J. DePasquale, Ph.D.
>>> Department of Computer Science
>>> The College of New Jersey
>>> (e) depasqua [at] tcnj [dot] edu
>>> (p) 609-771-2806
>>> (f) 609-637-5190
>>> (o) Holman Hall - Room 238
>>> (l) Holman Hall - Room 255
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>



-- 
Peter J. DePasquale, Ph.D.
Department of Computer Science
The College of New Jersey
(e) depasqua [at] tcnj [dot] edu
(p) 609-771-2806
(f) 609-637-5190
(o) Holman Hall - Room 238
(l) Holman Hall - Room 255

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: Two classes, logging to the same file...

Posted by Ralph Goers <ra...@dslextreme.com>.
OK - I tried my theory and didn't have any problems.

Ralph

On Oct 23, 2012, at 10:59 AM, Ralph Goers wrote:

> That is good to know. However, your test has spawned a suspicion that the problem may be related to one class starting with the name of the other.  Try renaming Comtor or ComtorStandAlone so they don't overlap and see if the problem goes away.  If it does then it is a bug in Log4j.
> 
> I'll try modifying my test to emulate that and see if I get the problem.
> 
> Ralph
> 
> 
> On Oct 23, 2012, at 10:35 AM, Peter DePasquale wrote:
> 
>> So I was able to download this and replicate your results.
>> 
>> I've adjusted my logger config to account for other classes in a
>> different package (org.comtor rather than org.comtor.drivers) and that
>> works. Thus, my issue apparently is specific to this particular one
>> class. Debugging continues as I have the time.
>> 
>> On Tue, Oct 23, 2012 at 3:47 AM, Ralph Goers <ra...@dslextreme.com> wrote:
>>> I copied the log4j api and core jars into /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/lib/ext/ on my Mac.  I found a project I had used before that had two classes and modified it slightly for this test.  I ran the test and got the following output (which will probably look terrible after it is emailed).   The log4j2.xml file was in the classes directory of my project so it could be found in the classpath.  I will attempt to add the project zip to the email but I don't know if this list accepts attachments.  I also got an output file which should be in the "target" directory in the zip.
>>> 
>>> Ralph
>>> 
>>> java -cp /Users/rgoers/test/log4jtest/test/target/classes com.test.App
>>> 2012-10-23 00:44:26,908 DEBUG Generated plugins in 0.000012000 seconds
>>> 2012-10-23 00:44:26,916 DEBUG Calling createFilter on class org.apache.logging.log4j.core.filter.ThresholdFilter for element ThresholdFilter with params(level="ERROR", onMatch="ACCEPT", onMismatch="DENY")
>>> 2012-10-23 00:44:26,920 DEBUG Calling createLayout on class org.apache.logging.log4j.core.layout.PatternLayout for element PatternLayout with params(pattern="%d{HH:mm:ss.SSS} %-5level %class{36} %L %M - %msg%xEx%n", Configuration, null, charset="null")
>>> 2012-10-23 00:44:26,920 DEBUG Generated plugins in 0.000010000 seconds
>>> 2012-10-23 00:44:26,922 DEBUG Calling createAppender on class org.apache.logging.log4j.core.appender.ConsoleAppender for element Console with params(PatternLayout(%d{HH:mm:ss.SSS} %-5level %class{36} %L %M - %msg%xEx%n), ThresholdFilter(ERROR), target="SYSTEM_OUT", name="Console", suppressExceptions="null")
>>> 2012-10-23 00:44:26,923 DEBUG Calling createLayout on class org.apache.logging.log4j.core.layout.PatternLayout for element PatternLayout with params(pattern="%d{HH:mm:ss.SSS} %-5level %class{36} %L %M - %msg%xEx%n", Configuration, null, charset="null")
>>> 2012-10-23 00:44:26,925 DEBUG Calling createAppender on class org.apache.logging.log4j.core.appender.FileAppender for element File with params(fileName="target/test.log", append="false", locking="null", name="log", immediateFlush="null", suppressExceptions="null", bufferedIO="null", PatternLayout(%d{HH:mm:ss.SSS} %-5level %class{36} %L %M - %msg%xEx%n), null)
>>> 2012-10-23 00:44:26,943 DEBUG Starting FileManager target/test.log
>>> 2012-10-23 00:44:26,943 DEBUG Calling createAppenders on class org.apache.logging.log4j.core.config.plugins.AppendersPlugin for element appenders with params(appenders={Console, log})
>>> 2012-10-23 00:44:26,944 DEBUG Generated plugins in 0.000016000 seconds
>>> 2012-10-23 00:44:26,945 DEBUG Calling createAppenderRef on class org.apache.logging.log4j.core.config.AppenderRef for element appender-ref with params(ref="log", level="null", null)
>>> 2012-10-23 00:44:26,946 DEBUG Calling createLogger on class org.apache.logging.log4j.core.config.LoggerConfig for element logger with params(additivity="false", level="trace", name="com.test", appender-ref={org.apache.logging.log4j.core.config.AppenderRef@44a613f8}, properties={}, Configuration, null)
>>> 2012-10-23 00:44:26,947 DEBUG Calling createAppenderRef on class org.apache.logging.log4j.core.config.AppenderRef for element appender-ref with params(ref="Console", level="null", null)
>>> 2012-10-23 00:44:26,948 DEBUG Calling createLogger on class org.apache.logging.log4j.core.config.LoggerConfig$RootLogger for element root with params(additivity="null", level="debug", appender-ref={org.apache.logging.log4j.core.config.AppenderRef@736921fd}, properties={}, Configuration, null)
>>> 2012-10-23 00:44:26,949 DEBUG Calling createLoggers on class org.apache.logging.log4j.core.config.plugins.LoggersPlugin for element loggers with params(loggers={com.test, root})
>>> 2012-10-23 00:44:26,950 DEBUG Reconfiguration completed
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> On Oct 22, 2012, at 10:02 PM, Ralph Goers wrote:
>>> 
>>>> OK - I haven't tried installing into lib/ext. I will see if I can create a couple of classes to emulate what you are describing until you can get me a zip. I assume one or both of these has a main?  Where did you place log4j2.xml?
>>>> 
>>>> Ralph
>>>> 
>>>> On Oct 22, 2012, at 7:44 PM, Peter DePasquale wrote:
>>>> 
>>>>> Yep, both in one jar (mine), with the two log4j2 jars in the /lib/ext
>>>>> area.  Will have to work on the zip and get back to you....
>>>>> 
>>>>> On Mon, Oct 22, 2012 at 10:38 PM, Ralph Goers
>>>>> <ra...@dslextreme.com> wrote:
>>>>>> In theory, what you are describing should be working.  Are the two classes in one jar with Log4j in separate jars? Is it possible for you to provide a zip of your project with the two classes exactly as it is packaged?
>>>>>> 
>>>>>> Ralph
>>>>>> 
>>>>>> 
>>>>>> On Oct 22, 2012, at 5:51 PM, Peter DePasquale wrote:
>>>>>> 
>>>>>>> Ok, I'm new, and I'm stumped.  Here's my log4j2 config file:
>>>>>>> 
>>>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>>>> <configuration status="debug">
>>>>>>>   <appenders>
>>>>>>>           <Console name="Console" target="SYSTEM_OUT">
>>>>>>>                   <PatternLayout pattern="%d{HH:mm:ss} [%t] %-5level %logger{36} - %msg%n"/>
>>>>>>>           </Console>
>>>>>>> 
>>>>>>>           <File name="DriversFile" fileName="trace-drivers.txt"
>>>>>>> suppressExceptions="false" append="false">
>>>>>>>                   <PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} %p %C [%t] %m%n"/>
>>>>>>>           </File>
>>>>>>>   </appenders>
>>>>>>> 
>>>>>>>   <loggers>
>>>>>>>           <logger name="org.comtor.drivers" level="trace" additivity="false">
>>>>>>>                   <appender-ref ref="DriversFile"/>
>>>>>>>           </logger>
>>>>>>> 
>>>>>>>           <root level="error">
>>>>>>>                   <appender-ref ref="Console"/>
>>>>>>>           </root>
>>>>>>>   </loggers>
>>>>>>> </configuration>
>>>>>>> 
>>>>>>> Note that the config status="debug". I have two classes that I'm
>>>>>>> monkeying with to get Log4J2 working. They are:
>>>>>>> 
>>>>>>> org.comtor.drivers.Comtor, and
>>>>>>> org.comtor.drivers.ComtorStandAlone
>>>>>>> 
>>>>>>> At this point, I'm only using a handful (and I mean small numbers
>>>>>>> here) of .trace(), .entry(), and .exit() method calls.
>>>>>>> 
>>>>>>> If I do this in file #2 (ComtorStandAlone), I can get the tracing to
>>>>>>> write to the file specified in the config file above (as well as DEBUG
>>>>>>> statements from log4j2 on the console). Ok, cool. But when I add
>>>>>>> logging to the first file (Comtor) thereby in theory logging from two
>>>>>>> classes in the program, NOTHING happens. No config file logging to the
>>>>>>> console, no output file, nothing.
>>>>>>> 
>>>>>>> Am I misunderstanding the capability to have the "org.comtor.drivers"
>>>>>>> logger catch, process, and write to the same file? In fact, if I only
>>>>>>> create the Logger object in the second file (private static Logger
>>>>>>> logger = LogManager.getLogger(Comtor.class.getName());) without
>>>>>>> attempting to call .trace(), .entry(), or .exit(), the problem
>>>>>>> manifests itself (no output, no file, nothing).
>>>>>>> 
>>>>>>> I'd appreciate any insight here, as I'm really at a loss. Thanks.
>>>>>>> 
>>>>>>> --
>>>>>>> Peter J. DePasquale, Ph.D.
>>>>>>> Department of Computer Science
>>>>>>> The College of New Jersey
>>>>>>> (e) depasqua [at] tcnj [dot] edu
>>>>>>> (p) 609-771-2806
>>>>>>> (f) 609-637-5190
>>>>>>> (o) Holman Hall - Room 238
>>>>>>> (l) Holman Hall - Room 255
>>>>>>> 
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>>>>>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>>>>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> --
>>>>> Peter J. DePasquale, Ph.D.
>>>>> Department of Computer Science
>>>>> The College of New Jersey
>>>>> (e) depasqua [at] tcnj [dot] edu
>>>>> (p) 609-771-2806
>>>>> (f) 609-637-5190
>>>>> (o) Holman Hall - Room 238
>>>>> (l) Holman Hall - Room 255
>>>>> 
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>>>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>>>> 
>>>> 
>>> 
>>> 
>>> 
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>> 
>> 
>> 
>> -- 
>> Peter J. DePasquale, Ph.D.
>> Department of Computer Science
>> The College of New Jersey
>> (e) depasqua [at] tcnj [dot] edu
>> (p) 609-771-2806
>> (f) 609-637-5190
>> (o) Holman Hall - Room 238
>> (l) Holman Hall - Room 255
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: Two classes, logging to the same file...

Posted by Ralph Goers <ra...@dslextreme.com>.
That is good to know. However, your test has spawned a suspicion that the problem may be related to one class starting with the name of the other.  Try renaming Comtor or ComtorStandAlone so they don't overlap and see if the problem goes away.  If it does then it is a bug in Log4j.

I'll try modifying my test to emulate that and see if I get the problem.

Ralph


On Oct 23, 2012, at 10:35 AM, Peter DePasquale wrote:

> So I was able to download this and replicate your results.
> 
> I've adjusted my logger config to account for other classes in a
> different package (org.comtor rather than org.comtor.drivers) and that
> works. Thus, my issue apparently is specific to this particular one
> class. Debugging continues as I have the time.
> 
> On Tue, Oct 23, 2012 at 3:47 AM, Ralph Goers <ra...@dslextreme.com> wrote:
>> I copied the log4j api and core jars into /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/lib/ext/ on my Mac.  I found a project I had used before that had two classes and modified it slightly for this test.  I ran the test and got the following output (which will probably look terrible after it is emailed).   The log4j2.xml file was in the classes directory of my project so it could be found in the classpath.  I will attempt to add the project zip to the email but I don't know if this list accepts attachments.  I also got an output file which should be in the "target" directory in the zip.
>> 
>> Ralph
>> 
>> java -cp /Users/rgoers/test/log4jtest/test/target/classes com.test.App
>> 2012-10-23 00:44:26,908 DEBUG Generated plugins in 0.000012000 seconds
>> 2012-10-23 00:44:26,916 DEBUG Calling createFilter on class org.apache.logging.log4j.core.filter.ThresholdFilter for element ThresholdFilter with params(level="ERROR", onMatch="ACCEPT", onMismatch="DENY")
>> 2012-10-23 00:44:26,920 DEBUG Calling createLayout on class org.apache.logging.log4j.core.layout.PatternLayout for element PatternLayout with params(pattern="%d{HH:mm:ss.SSS} %-5level %class{36} %L %M - %msg%xEx%n", Configuration, null, charset="null")
>> 2012-10-23 00:44:26,920 DEBUG Generated plugins in 0.000010000 seconds
>> 2012-10-23 00:44:26,922 DEBUG Calling createAppender on class org.apache.logging.log4j.core.appender.ConsoleAppender for element Console with params(PatternLayout(%d{HH:mm:ss.SSS} %-5level %class{36} %L %M - %msg%xEx%n), ThresholdFilter(ERROR), target="SYSTEM_OUT", name="Console", suppressExceptions="null")
>> 2012-10-23 00:44:26,923 DEBUG Calling createLayout on class org.apache.logging.log4j.core.layout.PatternLayout for element PatternLayout with params(pattern="%d{HH:mm:ss.SSS} %-5level %class{36} %L %M - %msg%xEx%n", Configuration, null, charset="null")
>> 2012-10-23 00:44:26,925 DEBUG Calling createAppender on class org.apache.logging.log4j.core.appender.FileAppender for element File with params(fileName="target/test.log", append="false", locking="null", name="log", immediateFlush="null", suppressExceptions="null", bufferedIO="null", PatternLayout(%d{HH:mm:ss.SSS} %-5level %class{36} %L %M - %msg%xEx%n), null)
>> 2012-10-23 00:44:26,943 DEBUG Starting FileManager target/test.log
>> 2012-10-23 00:44:26,943 DEBUG Calling createAppenders on class org.apache.logging.log4j.core.config.plugins.AppendersPlugin for element appenders with params(appenders={Console, log})
>> 2012-10-23 00:44:26,944 DEBUG Generated plugins in 0.000016000 seconds
>> 2012-10-23 00:44:26,945 DEBUG Calling createAppenderRef on class org.apache.logging.log4j.core.config.AppenderRef for element appender-ref with params(ref="log", level="null", null)
>> 2012-10-23 00:44:26,946 DEBUG Calling createLogger on class org.apache.logging.log4j.core.config.LoggerConfig for element logger with params(additivity="false", level="trace", name="com.test", appender-ref={org.apache.logging.log4j.core.config.AppenderRef@44a613f8}, properties={}, Configuration, null)
>> 2012-10-23 00:44:26,947 DEBUG Calling createAppenderRef on class org.apache.logging.log4j.core.config.AppenderRef for element appender-ref with params(ref="Console", level="null", null)
>> 2012-10-23 00:44:26,948 DEBUG Calling createLogger on class org.apache.logging.log4j.core.config.LoggerConfig$RootLogger for element root with params(additivity="null", level="debug", appender-ref={org.apache.logging.log4j.core.config.AppenderRef@736921fd}, properties={}, Configuration, null)
>> 2012-10-23 00:44:26,949 DEBUG Calling createLoggers on class org.apache.logging.log4j.core.config.plugins.LoggersPlugin for element loggers with params(loggers={com.test, root})
>> 2012-10-23 00:44:26,950 DEBUG Reconfiguration completed
>> 
>> 
>> 
>> 
>> 
>> 
>> On Oct 22, 2012, at 10:02 PM, Ralph Goers wrote:
>> 
>>> OK - I haven't tried installing into lib/ext. I will see if I can create a couple of classes to emulate what you are describing until you can get me a zip. I assume one or both of these has a main?  Where did you place log4j2.xml?
>>> 
>>> Ralph
>>> 
>>> On Oct 22, 2012, at 7:44 PM, Peter DePasquale wrote:
>>> 
>>>> Yep, both in one jar (mine), with the two log4j2 jars in the /lib/ext
>>>> area.  Will have to work on the zip and get back to you....
>>>> 
>>>> On Mon, Oct 22, 2012 at 10:38 PM, Ralph Goers
>>>> <ra...@dslextreme.com> wrote:
>>>>> In theory, what you are describing should be working.  Are the two classes in one jar with Log4j in separate jars? Is it possible for you to provide a zip of your project with the two classes exactly as it is packaged?
>>>>> 
>>>>> Ralph
>>>>> 
>>>>> 
>>>>> On Oct 22, 2012, at 5:51 PM, Peter DePasquale wrote:
>>>>> 
>>>>>> Ok, I'm new, and I'm stumped.  Here's my log4j2 config file:
>>>>>> 
>>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>>> <configuration status="debug">
>>>>>>    <appenders>
>>>>>>            <Console name="Console" target="SYSTEM_OUT">
>>>>>>                    <PatternLayout pattern="%d{HH:mm:ss} [%t] %-5level %logger{36} - %msg%n"/>
>>>>>>            </Console>
>>>>>> 
>>>>>>            <File name="DriversFile" fileName="trace-drivers.txt"
>>>>>> suppressExceptions="false" append="false">
>>>>>>                    <PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} %p %C [%t] %m%n"/>
>>>>>>            </File>
>>>>>>    </appenders>
>>>>>> 
>>>>>>    <loggers>
>>>>>>            <logger name="org.comtor.drivers" level="trace" additivity="false">
>>>>>>                    <appender-ref ref="DriversFile"/>
>>>>>>            </logger>
>>>>>> 
>>>>>>            <root level="error">
>>>>>>                    <appender-ref ref="Console"/>
>>>>>>            </root>
>>>>>>    </loggers>
>>>>>> </configuration>
>>>>>> 
>>>>>> Note that the config status="debug". I have two classes that I'm
>>>>>> monkeying with to get Log4J2 working. They are:
>>>>>> 
>>>>>> org.comtor.drivers.Comtor, and
>>>>>> org.comtor.drivers.ComtorStandAlone
>>>>>> 
>>>>>> At this point, I'm only using a handful (and I mean small numbers
>>>>>> here) of .trace(), .entry(), and .exit() method calls.
>>>>>> 
>>>>>> If I do this in file #2 (ComtorStandAlone), I can get the tracing to
>>>>>> write to the file specified in the config file above (as well as DEBUG
>>>>>> statements from log4j2 on the console). Ok, cool. But when I add
>>>>>> logging to the first file (Comtor) thereby in theory logging from two
>>>>>> classes in the program, NOTHING happens. No config file logging to the
>>>>>> console, no output file, nothing.
>>>>>> 
>>>>>> Am I misunderstanding the capability to have the "org.comtor.drivers"
>>>>>> logger catch, process, and write to the same file? In fact, if I only
>>>>>> create the Logger object in the second file (private static Logger
>>>>>> logger = LogManager.getLogger(Comtor.class.getName());) without
>>>>>> attempting to call .trace(), .entry(), or .exit(), the problem
>>>>>> manifests itself (no output, no file, nothing).
>>>>>> 
>>>>>> I'd appreciate any insight here, as I'm really at a loss. Thanks.
>>>>>> 
>>>>>> --
>>>>>> Peter J. DePasquale, Ph.D.
>>>>>> Department of Computer Science
>>>>>> The College of New Jersey
>>>>>> (e) depasqua [at] tcnj [dot] edu
>>>>>> (p) 609-771-2806
>>>>>> (f) 609-637-5190
>>>>>> (o) Holman Hall - Room 238
>>>>>> (l) Holman Hall - Room 255
>>>>>> 
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>>>>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>>>>> 
>>>>> 
>>>>> 
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>>>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>>>> 
>>>> 
>>>> 
>>>> 
>>>> --
>>>> Peter J. DePasquale, Ph.D.
>>>> Department of Computer Science
>>>> The College of New Jersey
>>>> (e) depasqua [at] tcnj [dot] edu
>>>> (p) 609-771-2806
>>>> (f) 609-637-5190
>>>> (o) Holman Hall - Room 238
>>>> (l) Holman Hall - Room 255
>>>> 
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>>> 
>>> 
>> 
>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> 
> 
> -- 
> Peter J. DePasquale, Ph.D.
> Department of Computer Science
> The College of New Jersey
> (e) depasqua [at] tcnj [dot] edu
> (p) 609-771-2806
> (f) 609-637-5190
> (o) Holman Hall - Room 238
> (l) Holman Hall - Room 255
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: Two classes, logging to the same file...

Posted by Peter DePasquale <pe...@gmail.com>.
So I was able to download this and replicate your results.

I've adjusted my logger config to account for other classes in a
different package (org.comtor rather than org.comtor.drivers) and that
works. Thus, my issue apparently is specific to this particular one
class. Debugging continues as I have the time.

On Tue, Oct 23, 2012 at 3:47 AM, Ralph Goers <ra...@dslextreme.com> wrote:
> I copied the log4j api and core jars into /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/lib/ext/ on my Mac.  I found a project I had used before that had two classes and modified it slightly for this test.  I ran the test and got the following output (which will probably look terrible after it is emailed).   The log4j2.xml file was in the classes directory of my project so it could be found in the classpath.  I will attempt to add the project zip to the email but I don't know if this list accepts attachments.  I also got an output file which should be in the "target" directory in the zip.
>
> Ralph
>
> java -cp /Users/rgoers/test/log4jtest/test/target/classes com.test.App
> 2012-10-23 00:44:26,908 DEBUG Generated plugins in 0.000012000 seconds
> 2012-10-23 00:44:26,916 DEBUG Calling createFilter on class org.apache.logging.log4j.core.filter.ThresholdFilter for element ThresholdFilter with params(level="ERROR", onMatch="ACCEPT", onMismatch="DENY")
> 2012-10-23 00:44:26,920 DEBUG Calling createLayout on class org.apache.logging.log4j.core.layout.PatternLayout for element PatternLayout with params(pattern="%d{HH:mm:ss.SSS} %-5level %class{36} %L %M - %msg%xEx%n", Configuration, null, charset="null")
> 2012-10-23 00:44:26,920 DEBUG Generated plugins in 0.000010000 seconds
> 2012-10-23 00:44:26,922 DEBUG Calling createAppender on class org.apache.logging.log4j.core.appender.ConsoleAppender for element Console with params(PatternLayout(%d{HH:mm:ss.SSS} %-5level %class{36} %L %M - %msg%xEx%n), ThresholdFilter(ERROR), target="SYSTEM_OUT", name="Console", suppressExceptions="null")
> 2012-10-23 00:44:26,923 DEBUG Calling createLayout on class org.apache.logging.log4j.core.layout.PatternLayout for element PatternLayout with params(pattern="%d{HH:mm:ss.SSS} %-5level %class{36} %L %M - %msg%xEx%n", Configuration, null, charset="null")
> 2012-10-23 00:44:26,925 DEBUG Calling createAppender on class org.apache.logging.log4j.core.appender.FileAppender for element File with params(fileName="target/test.log", append="false", locking="null", name="log", immediateFlush="null", suppressExceptions="null", bufferedIO="null", PatternLayout(%d{HH:mm:ss.SSS} %-5level %class{36} %L %M - %msg%xEx%n), null)
> 2012-10-23 00:44:26,943 DEBUG Starting FileManager target/test.log
> 2012-10-23 00:44:26,943 DEBUG Calling createAppenders on class org.apache.logging.log4j.core.config.plugins.AppendersPlugin for element appenders with params(appenders={Console, log})
> 2012-10-23 00:44:26,944 DEBUG Generated plugins in 0.000016000 seconds
> 2012-10-23 00:44:26,945 DEBUG Calling createAppenderRef on class org.apache.logging.log4j.core.config.AppenderRef for element appender-ref with params(ref="log", level="null", null)
> 2012-10-23 00:44:26,946 DEBUG Calling createLogger on class org.apache.logging.log4j.core.config.LoggerConfig for element logger with params(additivity="false", level="trace", name="com.test", appender-ref={org.apache.logging.log4j.core.config.AppenderRef@44a613f8}, properties={}, Configuration, null)
> 2012-10-23 00:44:26,947 DEBUG Calling createAppenderRef on class org.apache.logging.log4j.core.config.AppenderRef for element appender-ref with params(ref="Console", level="null", null)
> 2012-10-23 00:44:26,948 DEBUG Calling createLogger on class org.apache.logging.log4j.core.config.LoggerConfig$RootLogger for element root with params(additivity="null", level="debug", appender-ref={org.apache.logging.log4j.core.config.AppenderRef@736921fd}, properties={}, Configuration, null)
> 2012-10-23 00:44:26,949 DEBUG Calling createLoggers on class org.apache.logging.log4j.core.config.plugins.LoggersPlugin for element loggers with params(loggers={com.test, root})
> 2012-10-23 00:44:26,950 DEBUG Reconfiguration completed
>
>
>
>
>
>
> On Oct 22, 2012, at 10:02 PM, Ralph Goers wrote:
>
>> OK - I haven't tried installing into lib/ext. I will see if I can create a couple of classes to emulate what you are describing until you can get me a zip. I assume one or both of these has a main?  Where did you place log4j2.xml?
>>
>> Ralph
>>
>> On Oct 22, 2012, at 7:44 PM, Peter DePasquale wrote:
>>
>>> Yep, both in one jar (mine), with the two log4j2 jars in the /lib/ext
>>> area.  Will have to work on the zip and get back to you....
>>>
>>> On Mon, Oct 22, 2012 at 10:38 PM, Ralph Goers
>>> <ra...@dslextreme.com> wrote:
>>>> In theory, what you are describing should be working.  Are the two classes in one jar with Log4j in separate jars? Is it possible for you to provide a zip of your project with the two classes exactly as it is packaged?
>>>>
>>>> Ralph
>>>>
>>>>
>>>> On Oct 22, 2012, at 5:51 PM, Peter DePasquale wrote:
>>>>
>>>>> Ok, I'm new, and I'm stumped.  Here's my log4j2 config file:
>>>>>
>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>> <configuration status="debug">
>>>>>     <appenders>
>>>>>             <Console name="Console" target="SYSTEM_OUT">
>>>>>                     <PatternLayout pattern="%d{HH:mm:ss} [%t] %-5level %logger{36} - %msg%n"/>
>>>>>             </Console>
>>>>>
>>>>>             <File name="DriversFile" fileName="trace-drivers.txt"
>>>>> suppressExceptions="false" append="false">
>>>>>                     <PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} %p %C [%t] %m%n"/>
>>>>>             </File>
>>>>>     </appenders>
>>>>>
>>>>>     <loggers>
>>>>>             <logger name="org.comtor.drivers" level="trace" additivity="false">
>>>>>                     <appender-ref ref="DriversFile"/>
>>>>>             </logger>
>>>>>
>>>>>             <root level="error">
>>>>>                     <appender-ref ref="Console"/>
>>>>>             </root>
>>>>>     </loggers>
>>>>> </configuration>
>>>>>
>>>>> Note that the config status="debug". I have two classes that I'm
>>>>> monkeying with to get Log4J2 working. They are:
>>>>>
>>>>> org.comtor.drivers.Comtor, and
>>>>> org.comtor.drivers.ComtorStandAlone
>>>>>
>>>>> At this point, I'm only using a handful (and I mean small numbers
>>>>> here) of .trace(), .entry(), and .exit() method calls.
>>>>>
>>>>> If I do this in file #2 (ComtorStandAlone), I can get the tracing to
>>>>> write to the file specified in the config file above (as well as DEBUG
>>>>> statements from log4j2 on the console). Ok, cool. But when I add
>>>>> logging to the first file (Comtor) thereby in theory logging from two
>>>>> classes in the program, NOTHING happens. No config file logging to the
>>>>> console, no output file, nothing.
>>>>>
>>>>> Am I misunderstanding the capability to have the "org.comtor.drivers"
>>>>> logger catch, process, and write to the same file? In fact, if I only
>>>>> create the Logger object in the second file (private static Logger
>>>>> logger = LogManager.getLogger(Comtor.class.getName());) without
>>>>> attempting to call .trace(), .entry(), or .exit(), the problem
>>>>> manifests itself (no output, no file, nothing).
>>>>>
>>>>> I'd appreciate any insight here, as I'm really at a loss. Thanks.
>>>>>
>>>>> --
>>>>> Peter J. DePasquale, Ph.D.
>>>>> Department of Computer Science
>>>>> The College of New Jersey
>>>>> (e) depasqua [at] tcnj [dot] edu
>>>>> (p) 609-771-2806
>>>>> (f) 609-637-5190
>>>>> (o) Holman Hall - Room 238
>>>>> (l) Holman Hall - Room 255
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>>>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>>>
>>>
>>>
>>>
>>> --
>>> Peter J. DePasquale, Ph.D.
>>> Department of Computer Science
>>> The College of New Jersey
>>> (e) depasqua [at] tcnj [dot] edu
>>> (p) 609-771-2806
>>> (f) 609-637-5190
>>> (o) Holman Hall - Room 238
>>> (l) Holman Hall - Room 255
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>>
>>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org



-- 
Peter J. DePasquale, Ph.D.
Department of Computer Science
The College of New Jersey
(e) depasqua [at] tcnj [dot] edu
(p) 609-771-2806
(f) 609-637-5190
(o) Holman Hall - Room 238
(l) Holman Hall - Room 255

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: Two classes, logging to the same file...

Posted by Ralph Goers <ra...@dslextreme.com>.
I copied the log4j api and core jars into /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/lib/ext/ on my Mac.  I found a project I had used before that had two classes and modified it slightly for this test.  I ran the test and got the following output (which will probably look terrible after it is emailed).   The log4j2.xml file was in the classes directory of my project so it could be found in the classpath.  I will attempt to add the project zip to the email but I don't know if this list accepts attachments.  I also got an output file which should be in the "target" directory in the zip.

Ralph

java -cp /Users/rgoers/test/log4jtest/test/target/classes com.test.App
2012-10-23 00:44:26,908 DEBUG Generated plugins in 0.000012000 seconds
2012-10-23 00:44:26,916 DEBUG Calling createFilter on class org.apache.logging.log4j.core.filter.ThresholdFilter for element ThresholdFilter with params(level="ERROR", onMatch="ACCEPT", onMismatch="DENY")
2012-10-23 00:44:26,920 DEBUG Calling createLayout on class org.apache.logging.log4j.core.layout.PatternLayout for element PatternLayout with params(pattern="%d{HH:mm:ss.SSS} %-5level %class{36} %L %M - %msg%xEx%n", Configuration, null, charset="null")
2012-10-23 00:44:26,920 DEBUG Generated plugins in 0.000010000 seconds
2012-10-23 00:44:26,922 DEBUG Calling createAppender on class org.apache.logging.log4j.core.appender.ConsoleAppender for element Console with params(PatternLayout(%d{HH:mm:ss.SSS} %-5level %class{36} %L %M - %msg%xEx%n), ThresholdFilter(ERROR), target="SYSTEM_OUT", name="Console", suppressExceptions="null")
2012-10-23 00:44:26,923 DEBUG Calling createLayout on class org.apache.logging.log4j.core.layout.PatternLayout for element PatternLayout with params(pattern="%d{HH:mm:ss.SSS} %-5level %class{36} %L %M - %msg%xEx%n", Configuration, null, charset="null")
2012-10-23 00:44:26,925 DEBUG Calling createAppender on class org.apache.logging.log4j.core.appender.FileAppender for element File with params(fileName="target/test.log", append="false", locking="null", name="log", immediateFlush="null", suppressExceptions="null", bufferedIO="null", PatternLayout(%d{HH:mm:ss.SSS} %-5level %class{36} %L %M - %msg%xEx%n), null)
2012-10-23 00:44:26,943 DEBUG Starting FileManager target/test.log
2012-10-23 00:44:26,943 DEBUG Calling createAppenders on class org.apache.logging.log4j.core.config.plugins.AppendersPlugin for element appenders with params(appenders={Console, log})
2012-10-23 00:44:26,944 DEBUG Generated plugins in 0.000016000 seconds
2012-10-23 00:44:26,945 DEBUG Calling createAppenderRef on class org.apache.logging.log4j.core.config.AppenderRef for element appender-ref with params(ref="log", level="null", null)
2012-10-23 00:44:26,946 DEBUG Calling createLogger on class org.apache.logging.log4j.core.config.LoggerConfig for element logger with params(additivity="false", level="trace", name="com.test", appender-ref={org.apache.logging.log4j.core.config.AppenderRef@44a613f8}, properties={}, Configuration, null)
2012-10-23 00:44:26,947 DEBUG Calling createAppenderRef on class org.apache.logging.log4j.core.config.AppenderRef for element appender-ref with params(ref="Console", level="null", null)
2012-10-23 00:44:26,948 DEBUG Calling createLogger on class org.apache.logging.log4j.core.config.LoggerConfig$RootLogger for element root with params(additivity="null", level="debug", appender-ref={org.apache.logging.log4j.core.config.AppenderRef@736921fd}, properties={}, Configuration, null)
2012-10-23 00:44:26,949 DEBUG Calling createLoggers on class org.apache.logging.log4j.core.config.plugins.LoggersPlugin for element loggers with params(loggers={com.test, root})
2012-10-23 00:44:26,950 DEBUG Reconfiguration completed


Re: Two classes, logging to the same file...

Posted by Ralph Goers <ra...@dslextreme.com>.
OK - I haven't tried installing into lib/ext. I will see if I can create a couple of classes to emulate what you are describing until you can get me a zip. I assume one or both of these has a main?  Where did you place log4j2.xml?  

Ralph

On Oct 22, 2012, at 7:44 PM, Peter DePasquale wrote:

> Yep, both in one jar (mine), with the two log4j2 jars in the /lib/ext
> area.  Will have to work on the zip and get back to you....
> 
> On Mon, Oct 22, 2012 at 10:38 PM, Ralph Goers
> <ra...@dslextreme.com> wrote:
>> In theory, what you are describing should be working.  Are the two classes in one jar with Log4j in separate jars? Is it possible for you to provide a zip of your project with the two classes exactly as it is packaged?
>> 
>> Ralph
>> 
>> 
>> On Oct 22, 2012, at 5:51 PM, Peter DePasquale wrote:
>> 
>>> Ok, I'm new, and I'm stumped.  Here's my log4j2 config file:
>>> 
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <configuration status="debug">
>>>      <appenders>
>>>              <Console name="Console" target="SYSTEM_OUT">
>>>                      <PatternLayout pattern="%d{HH:mm:ss} [%t] %-5level %logger{36} - %msg%n"/>
>>>              </Console>
>>> 
>>>              <File name="DriversFile" fileName="trace-drivers.txt"
>>> suppressExceptions="false" append="false">
>>>                      <PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} %p %C [%t] %m%n"/>
>>>              </File>
>>>      </appenders>
>>> 
>>>      <loggers>
>>>              <logger name="org.comtor.drivers" level="trace" additivity="false">
>>>                      <appender-ref ref="DriversFile"/>
>>>              </logger>
>>> 
>>>              <root level="error">
>>>                      <appender-ref ref="Console"/>
>>>              </root>
>>>      </loggers>
>>> </configuration>
>>> 
>>> Note that the config status="debug". I have two classes that I'm
>>> monkeying with to get Log4J2 working. They are:
>>> 
>>> org.comtor.drivers.Comtor, and
>>> org.comtor.drivers.ComtorStandAlone
>>> 
>>> At this point, I'm only using a handful (and I mean small numbers
>>> here) of .trace(), .entry(), and .exit() method calls.
>>> 
>>> If I do this in file #2 (ComtorStandAlone), I can get the tracing to
>>> write to the file specified in the config file above (as well as DEBUG
>>> statements from log4j2 on the console). Ok, cool. But when I add
>>> logging to the first file (Comtor) thereby in theory logging from two
>>> classes in the program, NOTHING happens. No config file logging to the
>>> console, no output file, nothing.
>>> 
>>> Am I misunderstanding the capability to have the "org.comtor.drivers"
>>> logger catch, process, and write to the same file? In fact, if I only
>>> create the Logger object in the second file (private static Logger
>>> logger = LogManager.getLogger(Comtor.class.getName());) without
>>> attempting to call .trace(), .entry(), or .exit(), the problem
>>> manifests itself (no output, no file, nothing).
>>> 
>>> I'd appreciate any insight here, as I'm really at a loss. Thanks.
>>> 
>>> --
>>> Peter J. DePasquale, Ph.D.
>>> Department of Computer Science
>>> The College of New Jersey
>>> (e) depasqua [at] tcnj [dot] edu
>>> (p) 609-771-2806
>>> (f) 609-637-5190
>>> (o) Holman Hall - Room 238
>>> (l) Holman Hall - Room 255
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>> 
> 
> 
> 
> -- 
> Peter J. DePasquale, Ph.D.
> Department of Computer Science
> The College of New Jersey
> (e) depasqua [at] tcnj [dot] edu
> (p) 609-771-2806
> (f) 609-637-5190
> (o) Holman Hall - Room 238
> (l) Holman Hall - Room 255
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: Two classes, logging to the same file...

Posted by Peter DePasquale <pe...@gmail.com>.
Yep, both in one jar (mine), with the two log4j2 jars in the /lib/ext
area.  Will have to work on the zip and get back to you....

On Mon, Oct 22, 2012 at 10:38 PM, Ralph Goers
<ra...@dslextreme.com> wrote:
> In theory, what you are describing should be working.  Are the two classes in one jar with Log4j in separate jars? Is it possible for you to provide a zip of your project with the two classes exactly as it is packaged?
>
> Ralph
>
>
> On Oct 22, 2012, at 5:51 PM, Peter DePasquale wrote:
>
>> Ok, I'm new, and I'm stumped.  Here's my log4j2 config file:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <configuration status="debug">
>>       <appenders>
>>               <Console name="Console" target="SYSTEM_OUT">
>>                       <PatternLayout pattern="%d{HH:mm:ss} [%t] %-5level %logger{36} - %msg%n"/>
>>               </Console>
>>
>>               <File name="DriversFile" fileName="trace-drivers.txt"
>> suppressExceptions="false" append="false">
>>                       <PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} %p %C [%t] %m%n"/>
>>               </File>
>>       </appenders>
>>
>>       <loggers>
>>               <logger name="org.comtor.drivers" level="trace" additivity="false">
>>                       <appender-ref ref="DriversFile"/>
>>               </logger>
>>
>>               <root level="error">
>>                       <appender-ref ref="Console"/>
>>               </root>
>>       </loggers>
>> </configuration>
>>
>> Note that the config status="debug". I have two classes that I'm
>> monkeying with to get Log4J2 working. They are:
>>
>> org.comtor.drivers.Comtor, and
>> org.comtor.drivers.ComtorStandAlone
>>
>> At this point, I'm only using a handful (and I mean small numbers
>> here) of .trace(), .entry(), and .exit() method calls.
>>
>> If I do this in file #2 (ComtorStandAlone), I can get the tracing to
>> write to the file specified in the config file above (as well as DEBUG
>> statements from log4j2 on the console). Ok, cool. But when I add
>> logging to the first file (Comtor) thereby in theory logging from two
>> classes in the program, NOTHING happens. No config file logging to the
>> console, no output file, nothing.
>>
>> Am I misunderstanding the capability to have the "org.comtor.drivers"
>> logger catch, process, and write to the same file? In fact, if I only
>> create the Logger object in the second file (private static Logger
>> logger = LogManager.getLogger(Comtor.class.getName());) without
>> attempting to call .trace(), .entry(), or .exit(), the problem
>> manifests itself (no output, no file, nothing).
>>
>> I'd appreciate any insight here, as I'm really at a loss. Thanks.
>>
>> --
>> Peter J. DePasquale, Ph.D.
>> Department of Computer Science
>> The College of New Jersey
>> (e) depasqua [at] tcnj [dot] edu
>> (p) 609-771-2806
>> (f) 609-637-5190
>> (o) Holman Hall - Room 238
>> (l) Holman Hall - Room 255
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>



-- 
Peter J. DePasquale, Ph.D.
Department of Computer Science
The College of New Jersey
(e) depasqua [at] tcnj [dot] edu
(p) 609-771-2806
(f) 609-637-5190
(o) Holman Hall - Room 238
(l) Holman Hall - Room 255

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: Two classes, logging to the same file...

Posted by Ralph Goers <ra...@dslextreme.com>.
In theory, what you are describing should be working.  Are the two classes in one jar with Log4j in separate jars? Is it possible for you to provide a zip of your project with the two classes exactly as it is packaged?

Ralph


On Oct 22, 2012, at 5:51 PM, Peter DePasquale wrote:

> Ok, I'm new, and I'm stumped.  Here's my log4j2 config file:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <configuration status="debug">
> 	<appenders>
> 		<Console name="Console" target="SYSTEM_OUT">
> 			<PatternLayout pattern="%d{HH:mm:ss} [%t] %-5level %logger{36} - %msg%n"/>
> 		</Console>
> 
> 		<File name="DriversFile" fileName="trace-drivers.txt"
> suppressExceptions="false" append="false">
> 			<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} %p %C [%t] %m%n"/>
> 		</File>
> 	</appenders>
> 	
> 	<loggers>
> 		<logger name="org.comtor.drivers" level="trace" additivity="false">
> 			<appender-ref ref="DriversFile"/>
> 		</logger>
> 
> 		<root level="error">
> 			<appender-ref ref="Console"/>
> 		</root>
> 	</loggers>
> </configuration>
> 
> Note that the config status="debug". I have two classes that I'm
> monkeying with to get Log4J2 working. They are:
> 
> org.comtor.drivers.Comtor, and
> org.comtor.drivers.ComtorStandAlone
> 
> At this point, I'm only using a handful (and I mean small numbers
> here) of .trace(), .entry(), and .exit() method calls.
> 
> If I do this in file #2 (ComtorStandAlone), I can get the tracing to
> write to the file specified in the config file above (as well as DEBUG
> statements from log4j2 on the console). Ok, cool. But when I add
> logging to the first file (Comtor) thereby in theory logging from two
> classes in the program, NOTHING happens. No config file logging to the
> console, no output file, nothing.
> 
> Am I misunderstanding the capability to have the "org.comtor.drivers"
> logger catch, process, and write to the same file? In fact, if I only
> create the Logger object in the second file (private static Logger
> logger = LogManager.getLogger(Comtor.class.getName());) without
> attempting to call .trace(), .entry(), or .exit(), the problem
> manifests itself (no output, no file, nothing).
> 
> I'd appreciate any insight here, as I'm really at a loss. Thanks.
> 
> -- 
> Peter J. DePasquale, Ph.D.
> Department of Computer Science
> The College of New Jersey
> (e) depasqua [at] tcnj [dot] edu
> (p) 609-771-2806
> (f) 609-637-5190
> (o) Holman Hall - Room 238
> (l) Holman Hall - Room 255
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org