Question

I'm using SLF4J with Log4J underneath. What access levels should I be setting my loggers to?

static final Logger logger = LoggerFactory.getLogger(ClassName.class);
Was it helpful?

Solution

I think you should use private access level, because every class should have its own copy of logger. Otherwise we can't tell which class really did the log record.

OTHER TIPS

I always set them to private. Is there any reason any other class would need access to this logger?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top