NetBeans Forums
| View previous topic :: View next topic |
| Author |
Message |
BarenS
Joined: 29 Dec 2009 Posts: 11
|
Posted: Tue Dec 29, 2009 1:06 pm Post subject: Using for logging org-openide-io to lo |
|
|
What is the best way to use an Netbeans Output Window to show logging messages ?
I want to use standard JDK logging in normal java applications, but want the log messages be shown in an Netbwans Output Window:
Example:
| Code: |
private Logger log = Logger.getLogger(MyMessage.class.getName());
...
log.info("command: " + command);
|
The log.info should be written to Netbeans Output Window
What's the best way to handle this ? |
|
| Back to top |
|
 |
Gregg Wonderly Posted via mailing list.
|
Posted: Tue Dec 29, 2009 3:26 pm Post subject: [platform-dev] Re: Using for logging org-openide-io to lo |
|
|
I have a module with an installer that does:
public class Installer extends ModuleInstall {
InputOutput io;
@Override
public void restored() {
io = IOProvider.getDefault().getIO("Application Logging", true );
Handler h = new Handler() {
@Override
public void publish(LogRecord record) {
String str = getFormatter().format( record );
io.getOut().print(str);
flush();
}
@Override
public void flush() {
io.getOut().flush();
}
@Override
public void close() throws SecurityException {
io.getOut().close();
}
};
// This is my custom formatter for log message formatting
h.setFormatter( new StreamFormatter() );
Logger.getLogger("").addHandler(h);
}
}
Gregg Wonderly
BarenS wrote:
| Quote: | What is the best way to use an Netbeans Output Window to show logging messages ?
I want to use standard JDK logging in normal java applications, but want the log messages be shown in an Netbwans Output Window:
Example:
Code:
private Logger log = Logger.getLogger(MyMessage.class.getName());
...
log.info("command: " + command);
The log.info should be written to Netbeans Output Window
What's the best way to handle this ?
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|