Not getting LoggerFactory as an import option for loggers | Community
Skip to main content
Level 4
Jul 5, 2023 4:27 AM UTC
Solved

Not getting LoggerFactory as an import option for loggers

I'm working on a util class. And trying to put a logger in it. But import logger from LoggerFactory is not appearing in the import list. What can be causing this issue as the same import is available in another file as an import. So, dependency is not an issue in this case.

Below are the imports I'm talking about.

import org.slf4j.Logger; import org.slf4j.LoggerFactory;
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
goyalkritikaAccepted solution
Level 4
Jul 5, 2023 5:05 AM UTC

The issue was the I was not initiating the variable itself. My bad.

private static final Logger LOGGER = LoggerFactory.getLogger(SessionManagementUtils.class);

3 replies

aanchal-sikka
New Participant
Jul 5, 2023 4:39 AM UTC

hello @goyalkritika 

 

Can you please try by creating a fresh workspace? Something might be corrupted.

- Commit the file

- Take a latest pull of the code in separate folder

- Import project in IDE and check

Translate
Aanchal Sikka
Level 4
Jul 5, 2023 4:49 AM UTC

Did that. It couldn't resolve the issue.

Translate
goyalkritikaAuthorAccepted solution
Level 4
Jul 5, 2023 5:05 AM UTC

The issue was the I was not initiating the variable itself. My bad.

private static final Logger LOGGER = LoggerFactory.getLogger(SessionManagementUtils.class);
Translate