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 <[email protected]> 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 <[email protected]> >>> 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 >>>>>> <[email protected]> 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: [email protected] >>>>>>>> For additional commands, e-mail: [email protected] >>>>>>>> >>>>>>> >>>>>>> >>>>>>> --------------------------------------------------------------------- >>>>>>> To unsubscribe, e-mail: [email protected] >>>>>>> For additional commands, e-mail: [email protected] >>>>>>> >>>>>> >>>>>> >>>>>> >>>>>> -- >>>>>> 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: [email protected] >>>>>> For additional commands, e-mail: [email protected] >>>>>> >>>>> >>>> >>>> >>>> >>>> >>>> --------------------------------------------------------------------- >>>> To unsubscribe, e-mail: [email protected] >>>> For additional commands, e-mail: [email protected] >>> >>> >>> >>> -- >>> 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: [email protected] >>> For additional commands, e-mail: [email protected] >>> >> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > -- 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: [email protected] For additional commands, e-mail: [email protected]
