Note that there are some explanatory texts on larger screens.

plurals
  1. POLogback logging not working
    primarykey
    data
    text
    <p>I've a Spring MVC simple addressbook project build with maven. I want to use Logback for logging, but I'm completely new to it; first I changed my pom.xml this way:</p> <pre><code>&lt;!-- Spring 3 dependencies --&gt; &lt;dependency&gt; &lt;groupId&gt;org.springframework&lt;/groupId&gt; &lt;artifactId&gt;spring-context&lt;/artifactId&gt; &lt;version&gt;${spring.version}&lt;/version&gt; &lt;exclusions&gt; &lt;!--Exclude Commons Logging in favor of SLF4j--&gt; &lt;exclusion&gt; &lt;groupId&gt;commons-logging&lt;/groupId&gt; &lt;artifactId&gt;commons-logging&lt;/artifactId&gt; &lt;/exclusion&gt; &lt;/exclusions&gt; &lt;/dependency&gt; &lt;!-- Logging --&gt; &lt;dependency&gt; &lt;groupId&gt;org.slf4j&lt;/groupId&gt; &lt;artifactId&gt;slf4j-api&lt;/artifactId&gt; &lt;version&gt;1.6.1&lt;/version&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;ch.qos.logback&lt;/groupId&gt; &lt;artifactId&gt;logback-classic&lt;/artifactId&gt; &lt;version&gt;${logback.version}&lt;/version&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;ch.qos.logback&lt;/groupId&gt; &lt;artifactId&gt;logback-core&lt;/artifactId&gt; &lt;version&gt;${logback.version}&lt;/version&gt; &lt;/dependency&gt; </code></pre> <p>then I added this lines to my custom Exception DatabaseException:</p> <pre><code>private final static Logger logger = (Logger) LoggerFactory.getLogger(DatabaseException.class); </code></pre> <p>...</p> <pre><code>public DatabaseException(Throwable cause) { super(cause); logger.log(Level.WARNING, cause.getMessage()); } </code></pre> <p>so that when I rise in other classes this exception the log is able to print to stout some messages, BUT DOES'T WORK, when I run maven on Tomcat it prints only container log [talledContainer] INFO .... etc etc. seems like my logger doesn't exists</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload