Harshil Sharma
Harshil Sharma

Reputation: 2035

Unable To Use ch.qos.logback.classic Classes

I have spring project setup on Intellij Idea 2016.2 using Maven. For some reason I cannot import or use any class present in ch.qos.logback.classic package. I tried to invalidate cache, re-import maven dependencies.

For example with

import ch.qos.logback.classic.Level;

the IDE says 'cannot resolve symbol Level'. When compiling from command line it says 'package ch.qos.logback.classic does not exist'. Any suggestion what might be wrong?

Update - found the issue. I had set dependency scope to compile. Updating this fixed the issue.

Upvotes: 4

Views: 10996

Answers (1)

davidxxx
davidxxx

Reputation: 131346

Have you added the ch.qos.logback:logback-classic Maven artifact in your dependencies?

You should have something like that in your pom :

<dependencies>
     ...
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>1.1.3</version>
        </dependency>
     ...
<dependencies>

Upvotes: 3

Related Questions