logging - Standard way to implement a Logger across classes in Java? -


I am creating a JavaFix application with many classes. I want to use Java logging from all classes. But all options come with excessive or repetitive code. These are the ones I can think of:

  1. Announce the wood as a personal stable last field in each class

    Personal Static Last Logger LOGGER = Logger .GetLogger (MyClass.class.getName ());

This option is disturbed by doing this in every category.

  1. Take the logger from the main category to each manufacturer

Do not feel elegant again

  1. Logger, and then call the steady ways on that square for each log item It looks like there is too much to make an additional class for logger.

How do you fight with this situation? Is it the case of choosing the least bad option?

I disagree about "excess". Third option: the "wrapper" option is actually quite elegant Because there is a dedicated class for logger () and it allows you to switch the rest of the code without any "hood" implementation (, etc.) to implement it

Such an implementation is in the form of Luigi mentioned in the comments.


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -