How do I remove Logger messages from Eclipse Console [message #206273] |
Wed, 08 June 2005 16:16  |
Eclipse User |
|
|
|
Hello. We are using java.util.logging.Logger to do logging of app events.
For anyone who doesn't know about this, it's a terrific feature that can
do a lot of cool things like automatically save log files when they reach
a certain size. We spent a lot of time coding and debugging such in other
languages.
PROBLEM:
Everything we log shows up in the Eclipse Console window.
And, it shows up in very verbose taking an extra line.
EXAMPLE:
Eclipse Console window shows messages like this:
Jun 8, 2005 11:34:28 AM com.companyname.pkgname.appname.Logger log
INFO: *** Program started ***
...when what we really want them to be just one line, similar to what we
are logging to a file, which looks like this:
2005-05-26 11:10:36 210 *** Program started ***
In summary, we can't figure out how to make eclipse not show log messages
nor can we make them look the way we want.
THINGS WE'VE TRIED:
Aside frome searching this list, the web and Javadoc, we have:
1. Tried to remove any superfluous handlers with code like this:
Handler h[] = logger.getHandlers();
for (int i = 0; i < h.length; i++) {
h[i].close();
logger.removeHandler(h[i]);
}
2. We created our own formatter. That's how our log file has the format
shown above. We would be happy if we could put a similar formatter in
place to make the log messages that show up in the Console window look the
way we want.
3. Looked around in eclipse: Windows,Preferences. We managed to change
the color so that System.out messages are different. This is not a an
adequate solution.
Can anyone offer any suggestions?
Has anyone been able to write messages to a log and NOT see them in the
Console window?
|
|
|
|
Re: How do I remove Logger messages from Eclipse Console [message #206305 is a reply to message #206273] |
Wed, 08 June 2005 17:35   |
Eclipse User |
|
|
|
The ProcessConsole does not know about loggers, it reads from the out
and error streams of its process and displays everything that it reads.
The console's contents should be the same as if the process were run
from the command line. If you find that it is not, please file a bug
against platform-debug.
There is an outstanding feature request that would allow you to filter
output (https://bugs.eclipse.org/bugs/show_bug.cgi?id=40705).
HTH
Kevin
Bill Ewing wrote:
> Hello. We are using java.util.logging.Logger to do logging of app
> events. For anyone who doesn't know about this, it's a terrific feature
> that can do a lot of cool things like automatically save log files when
> they reach a certain size. We spent a lot of time coding and debugging
> such in other languages.
>
> PROBLEM:
> Everything we log shows up in the Eclipse Console window.
> And, it shows up in very verbose taking an extra line.
>
> EXAMPLE:
> Eclipse Console window shows messages like this:
> Jun 8, 2005 11:34:28 AM com.companyname.pkgname.appname.Logger log
> INFO: *** Program started ***
>
> ..when what we really want them to be just one line, similar to what we
> are logging to a file, which looks like this:
> 2005-05-26 11:10:36 210 *** Program started ***
>
> In summary, we can't figure out how to make eclipse not show log
> messages nor can we make them look the way we want.
>
> THINGS WE'VE TRIED:
> Aside frome searching this list, the web and Javadoc, we have:
>
> 1. Tried to remove any superfluous handlers with code like this:
> Handler h[] = logger.getHandlers();
> for (int i = 0; i < h.length; i++) {
> h[i].close();
> logger.removeHandler(h[i]);
> }
>
> 2. We created our own formatter. That's how our log file has the format
> shown above. We would be happy if we could put a similar formatter in
> place to make the log messages that show up in the Console window look
> the way we want.
>
> 3. Looked around in eclipse: Windows,Preferences. We managed to change
> the color so that System.out messages are different. This is not a an
> adequate solution.
>
> Can anyone offer any suggestions?
>
> Has anyone been able to write messages to a log and NOT see them in the
> Console window?
>
|
|
|
|
Re: How do I remove Logger messages from Eclipse Console [message #206460 is a reply to message #206273] |
Fri, 10 June 2005 17:27  |
Eclipse User |
|
|
|
Originally posted by: wegener.cboenospam.com
Bill Ewing wrote:
> Hello. We are using java.util.logging.Logger to do logging of app events.
> For anyone who doesn't know about this, it's a terrific feature that can
> do a lot of cool things like automatically save log files when they reach
> a certain size. We spent a lot of time coding and debugging such in other
> languages.
> PROBLEM:
> Everything we log shows up in the Eclipse Console window.
> And, it shows up in very verbose taking an extra line.
> EXAMPLE:
> Eclipse Console window shows messages like this:
> Jun 8, 2005 11:34:28 AM com.companyname.pkgname.appname.Logger log
> INFO: *** Program started ***
> ...when what we really want them to be just one line, similar to what we
> are logging to a file, which looks like this:
> 2005-05-26 11:10:36 210 *** Program started ***
> In summary, we can't figure out how to make eclipse not show log messages
> nor can we make them look the way we want.
> THINGS WE'VE TRIED:
> Aside frome searching this list, the web and Javadoc, we have:
> 1. Tried to remove any superfluous handlers with code like this:
> Handler h[] = logger.getHandlers();
> for (int i = 0; i < h.length; i++) {
> h[i].close();
> logger.removeHandler(h[i]);
> }
> 2. We created our own formatter. That's how our log file has the format
> shown above. We would be happy if we could put a similar formatter in
> place to make the log messages that show up in the Console window look the
> way we want.
> 3. Looked around in eclipse: Windows,Preferences. We managed to change
> the color so that System.out messages are different. This is not a an
> adequate solution.
> Can anyone offer any suggestions?
> Has anyone been able to write messages to a log and NOT see them in the
> Console window?
The behavior you describe is the default behavior for the
java.util.logging.Logger. Eclipse has nothing to do with it. If you run
your application in a console window outside of Eclipse, you will see the
same thing. You need to override the default logging.properties file.
See the JavaDoc for the LogManager class.
I believe that the default properties file causes a ConsoleHander to be
added to the root logger (null string). Your attempt to remove all
handlers didn't work because the logger instance you removed handlers from
was not the root. The java.util.logging package loggers are hiearchical.
Log messages bubble up to parents unless you specifically tell the logger
not to. Any handler encountered along the way will try to process the log
request.
|
|
|
Powered by
FUDForum. Page generated in 0.02903 seconds