Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6778203
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:14:22+00:00 2026-05-26T16:14:22+00:00

When should we use the Logger API? For instance, on a InterruptedException in a

  • 0

When should we use the Logger API?

For instance, on a InterruptedException in a Thread – should we something along these lines ?

catch (InterruptedException ex) {
     Logger.getLogger(class1.class.getName()).log(Level.SEVERE, null, ex);
}

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T16:14:22+00:00Added an answer on May 26, 2026 at 4:14 pm

    Logs are used to debug programs and to replace print statements. They should not replace exceptions which need to be handled at a higher level. But they may accompany an exception (for example, if you need to rethrow an exception, the common idiom might be to log the exception to an error log file, and then to let the application crash or rethrow the exception as a runtime exception).

    There are basically 3 major uses for logging :

    1) To trace execution of an application while you are coding the application up, for example, for the first time (i.e. when you are prototyping with the intent to eventually produce a production app which isn’t spitting System.out statements all over the place), and to see the output – while building it, you add log statements (rather than print statements), at level DEBUG. At this time in the life cycle, your application would probably print all logs to the console.

    2) To generally see status updates or stream status updates to a user or to a file, so that you can ensure that your application is generally in the right “state” during execution. In this scenario, your loggers will probably have different levels (info, error, debug ….). Error messages might be printed to the console, while others would be dumped to a file, or potentially, ignored entirely.

    3) To debug a broken application. In this case, you might change the settings of your logging again to print everything to the console, or maybe, to at least dump all logs to a file, so that you can see what is happening.

    On a final note : It is more common to have a Logger factory, which is already centrally configured, rather than simply getting a static logger when you need to log a statement.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

It is to my understanding that one should use a forward-class declaration in the
Going to Google code page I couldn't find the API I should use to
MSDN says that you should use structs when you need lightweight objects. Are there
What GUI should use to run my JUnit tests, and how exactly do I
I've read I should use money , but in todays fast paced world maybe
Why sometimes I should use block and other times &block inside functions that accept
I know you should use POST whenever data will be modified on a public
I wonder how I should use the GTree (from GLib) to store data? Every
I know you should use a StringBuilder when concatenating strings but I was just
What kind of collection I should use to convert NameValue collection to be bindable

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.