NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

Using for logging org-openide-io to lo

 
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Platform Users
View previous topic :: View next topic  
Author Message
BarenS



Joined: 29 Dec 2009
Posts: 11

PostPosted: Tue Dec 29, 2009 1:06 pm    Post subject: Using for logging org-openide-io to lo Reply with 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
Gregg Wonderly
Posted via mailing list.





PostPosted: Tue Dec 29, 2009 3:26 pm    Post subject: [platform-dev] Re: Using for logging org-openide-io to lo Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Platform Users All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo