Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 343701 - Apache Log 4j returns multiple lines within console output
Summary: Apache Log 4j returns multiple lines within console output
Status: CLOSED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 3.7   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Debug-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-24 08:59 EDT by Jonathan Camilleri CLA
Modified: 2020-04-08 20:21 EDT (History)
1 user (show)

See Also:


Attachments
Source code (dummy) (4.08 KB, application/octet-stream)
2011-04-24 09:00 EDT, Jonathan Camilleri CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Camilleri CLA 2011-04-24 08:59:58 EDT
Build Identifier: Build id: M20110210-1200

It seems that including a logger object, results in multiple lines (in my case 6 lines) being returned, for example:

...
_log.debug("Cards held by dealer:");
...

results in
0 [main] DEBUG poker.Poker  - Cards held by dealer:
0 [main] DEBUG poker.Poker  - Cards held by dealer:
0 [main] DEBUG poker.Poker  - Cards held by dealer:
0 [main] DEBUG poker.Poker  - Cards held by dealer:
0 [main] DEBUG poker.Poker  - Cards held by dealer:
0 [main] DEBUG poker.Poker  - Cards held by dealer:

being displayed within the Console window.

whilst coding 'System.out.println("Cards held by dealer:");', results in:

'Cards held by dealer:' being displayed within the console window.



Reproducible: Always
Comment 1 Jonathan Camilleri CLA 2011-04-24 09:00:57 EDT
Created attachment 193967 [details]
Source code (dummy)

It seems that bug #331160 reported a similar issue, however it is assigned to a dummy inbox.
Comment 2 Dani Megert CLA 2011-04-26 03:37:18 EDT
Does the multiple logging also occur when you launch the example on the command line?
Comment 3 Jonathan Camilleri CLA 2011-04-26 03:50:17 EDT
(In reply to comment #2)
> Does the multiple logging also occur when you launch the example on the command
> line?

Well, somehow I'm getting a bunch of compilation errors when trying to compile through the command line, so it appears I have some debugging to do, however, I can't really understand why it seemed to be working within eclipse on 24.04.2011, and, I haven't changed much about Eclipse, although the source code has changed in the meantime.

However I tried running the command line on the source code originally attached.

@echo off
set CLASSPATH=.
javac *.java
java -Dlog4j.debug=true Poker
pause


Player.java:3: package org.apache.log4j does not exist
import org.apache.log4j.BasicConfigurator;
                       ^
Poker.java:12: package org.apache.log4j does not exist
import org.apache.log4j.BasicConfigurator;
                       ^
Poker.java:13: package org.apache.log4j does not exist
import org.apache.log4j.Logger;
                       ^
Poker.java:118: cannot find symbol
symbol  : class Logger
location: class poker.Poker
        private static final Logger _log = Logger.getLogger(Poker.class);
                             ^
Player.java:27: cannot find symbol
symbol  : variable BasicConfigurator
location: class poker.Player
        BasicConfigurator.configure();
        ^
Poker.java:24: cannot find symbol
symbol  : variable BasicConfigurator
location: class poker.Poker
        BasicConfigurator.configure();
        ^
Poker.java:118: cannot find symbol
symbol  : variable Logger
location: class poker.Poker
        private static final Logger _log = Logger.getLogger(Poker.class);
                                           ^
7 errors
Exception in thread "main" java.lang.NoClassDefFoundError: Poker
Caused by: java.lang.ClassNotFoundException: Poker
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: Poker.  Program will exit.
Press any key to continue . . .
Comment 4 Eclipse Genie CLA 2020-04-08 20:21:41 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.