简体   繁体   中英

how do I set the loggers in netbeans to print exceptions information to files?

I'm using NetBeans IDE to develop a project for my senior year. The project has to be handed as jar.

The project works fine within NetBeans ( when im using "run project"). So , I created an executeable jar file to it . Unfortunately , the jar file doesnt work , and probably throws execeptions that i cant see . My goal is to print those exceptions to a file , so I could see whats happing on that jar , and to debug it .

I know that netbeans is using deafult logging mode . A code like this one genereted when you try to catch exceptions :

    try {
        manipulate.Adapt.Adaption(tclass);
    } catch (Exception ex) {
        Logger.getLogger(PepperNewAnalysis.class.getName()).log(Level.SEVERE, null, ex);
    } 

I'm not fimilair with java logging methodlogy. I read some information in here , it was good , but not enough to my needs.

So , my question is - how do I tied up those logger - like the one up there for PepperNewAnalysis to a file ?

Is it possible to inform the global logger that all logging should be outputed into a file?

Again , all I want is to print some debug info like the trace of the exception into a file , for every exception that i can check in my project.

please help me , im running out of time.

thanks !

Netbeans uses java.util.logging API for logging. You should read about that, if you want to use the same. Otherwise, the most commonly used logger in Log4J, and its wrappers like SLF4J, LogBack etc.

IMO, you are good to go with the java.util.logging . Here you can find the java util logging guide .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM