
All right, this is exactly what I think is happening. In fact of that, if you put a call to the toString() method explicitly in the log line, the eclipse plugin works right: private Logger log = LoggerFactory.getLogger( TestingLogback.class.getSimpleName()); Car car = new Car("Mercedes") Integer aNumber = new Integer(2); log.debug("A correct log line: {}", aNumber); log.debug("A failed log line: {}", car.toString()); <--------- toString() method called log.debug("This line is unreachable for the logback plugin"); In this case, the eclipse plugin shows this output: A correct line: 2 A failed log line: Mercedes This line is unreachable for the logback plugin Your proposal for the resolution seems to be reasonable. Let's see what the developers think... 2007/9/26, Maarten Bosteels <maarten@apache.org>:
You are right, it doesn't work.
I think this is happening: * Logback is sending a serialized LoggingEvent over the socket * the LoggingEvent has a reference to the foo.bar.Car instance * the Eclipse plugin receives the bytes over the wire and tries to deserialize the LoggingEvent, this fails because the foo.bar.Car class is not on the classpath.
Resolution: I think the SocketAppender should only send the formattedMessage over the wire and not the argumentArray. In other words: argumentArray should be declared transient.
Let's see what the LogBack developers think about that ...
Maarten
On 9/26/07, Vicente Ferrer <vteferrer@gmail.com> wrote:
Hello,
My problem occurs when I put an own object (like a instance of a bean named 'Car' created for me) in a logback log line. A code like this:
private Logger log = LoggerFactory.getLogger(TestingLogback.class.getSimpleName ());
Car car = new Car("Mercedes"); Integer aNumber = new Integer(2);
log.debug("A correct log line: {}", aNumber); log.debug("A failed log line: {}", car); log.debug("This line is unreachable for the logback plugin");
The logback plugin just shows:
---- A correct log line: 2 ----
And the plugin doesn't show the rest lines of the class on the logback plugin. The "Error Log" plugin on Eclipse shows this error: "There was an error trying to deserialize LoggingEvent: java.lang.ClassNotFoundException: foo.bar.Car". But the console appender shows correctly all the log lines (the console is showing the output of the J2EE Server, and in its classpath, logback doesn't have any problem to reach the Car class)
Thanks in advance
2007/9/26, Maarten Bosteels <maarten@apache.org>:
Hello,
I am using the LogBack Eclipse plugin.
Eclipse version: Version: 3.3.0 Build id: I20070621-1340
I folowed the instructions from http://logback.qos.ch/consolePlugin.html and I just tried with the logback.xml configuration file from the instructions, and of course it works as well.
What exactly isn't working for you ?
Maarten
On 9/26/07, Vicente Ferrer < vteferrer@gmail.com> wrote:
Thanks for your response, Maarten.
If you don't put the <consolePlugin /> tag on logback.xml, what do you do to show the logback log lines on eclipse plugin? Or... aren't you ussing that plugin? Maybe are you using a log4j eclipse plugin, like Ganymede?
Thanks again
2007/9/25, Maarten Bosteels < maarten@apache.org>:
I forgot to mention that I have not tried the <consolePlugin /> tag.
I used the following logback.xml :
<?xml version="1.0" encoding="UTF-8"?> <configuration> <appender class=" ch.qos.logback.core.ConsoleAppender" name="RootConsoleAppender"> <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> <level>debug</level> </filter> <layout class="ch.qos.logback.classic.PatternLayout"> <pattern>%d{yyyy-MM-dd HH:mm:ss},%p,%c,%t %m%n</pattern> </layout> </appender> <appender class=" ch.qos.logback.classic.net.SocketAppender" name="RootSocketAppender"> <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> <level>debug</level> </filter> <remoteHost>mortimer.example.com</remoteHost> <port>4321</port> <reconnectionDelay>30000</reconnectionDelay> <includeCallerData>true</includeCallerData> </appender>
<root> <level value="debug"/> <appender-ref ref="RootConsoleAppender"/> <appender-ref ref="RootSocketAppender"/> </root> </configuration>
Maarten
On 9/25/07, Maarten Bosteels < maarten@apache.org> wrote:
I installed it today and it works. Haven't done extensive testing, but everything I tried (MDC and throwables) seems to work.
I would have preferred that logging events were shown in a table (column per field) instead of stringified. But I never use eclipse, so I don't really care :-)
Is anyone working on a plugin for Intellij IDEA ?
Maarten
On 9/25/07, Vicente Ferrer < vteferrer@gmail.com> wrote: > Hi to all, > > I'm having some problems with logback eclipse plugin... ¿somebody has used > the logback eclipse plugin with success? > > Thanks a lot. > > _______________________________________________ > logback-dev mailing list > logback-dev@qos.ch > http://qos.ch/mailman/listinfo/logback-dev > >
_______________________________________________ logback-dev mailing list logback-dev@qos.ch http://qos.ch/mailman/listinfo/logback-dev
_______________________________________________ logback-dev mailing list logback-dev@qos.ch http://qos.ch/mailman/listinfo/logback-dev
_______________________________________________ logback-dev mailing list logback-dev@qos.ch http://qos.ch/mailman/listinfo/logback-dev
_______________________________________________ logback-dev mailing list logback-dev@qos.ch http://qos.ch/mailman/listinfo/logback-dev
_______________________________________________ logback-dev mailing list logback-dev@qos.ch http://qos.ch/mailman/listinfo/logback-dev