What's the Logger !!?

Hello Experts

What's the logger in java, I realized when I create the try-catch in netbeans it catch the following line by default;

Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);

Can anyone enplane it to me pleaes


Regards
G
GhythsAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bruce SmithSoftware Engineer IICommented:
Java provides logging tools for implementing logging features in your java application. The Logger object contains log messages. Java logging provides a way to contain multiple types of message like: warning, info, severe etc. for a Java application. These information or messages can be used for many purposes but it is specially used for debugging, troubleshooting and auditing.

When an exception is caught in your Java application, the logger prints the log to the log file and to the console if you're using an IDE such as NetBeans.

You might get a better(more readable) result if you replace the following line of code:
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);

Open in new window

With
ex.printStackTrace();

Open in new window


HTH  CHeers

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
GhythsAuthor Commented:
but where the logger save/print the debugging information!!? @ patsmitty
Dushyant SharmaCommented:
the output can be configured through configuration files. In web application the default is webservers log file. for example catalina.out for tomcat. another default is console for development purpose.

this can always be changed to the requirement.
GhythsAuthor Commented:
Thanks ddsh79, got it.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.