Skip to content

Commit

Permalink
Switch to LeakListener, which logs via JDK instead of stdout/stderr
Browse files Browse the repository at this point in the history
  • Loading branch information
seanf committed Mar 12, 2014
1 parent 3089cb6 commit ac00fcb
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 3 deletions.
2 changes: 0 additions & 2 deletions zanata-war/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,6 @@
<usedDependency>org.jboss.as:jboss-as-controller</usedDependency>
<!-- used for gwt super devmode -->
<usedDependency>org.json:json</usedDependency>
<!-- used for leak detection (servlet listener) -->
<usedDependency>se.jiderhamn:classloader-leak-prevention</usedDependency>

<!-- Grandfathered entries: -->
<!-- TODO validate or remove each of these -->
Expand Down
59 changes: 59 additions & 0 deletions zanata-war/src/main/java/org/zanata/servlet/LeakListener.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
* Copyright 2014, Red Hat, Inc. and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/

package org.zanata.servlet;

import java.util.logging.Level;

import lombok.extern.java.Log;
import se.jiderhamn.classloader.leak.prevention.ClassLoaderLeakPreventor;

/**
* @author Sean Flanigan <a href="mailto:[email protected]">[email protected]</a>
*
*/
@Log
public class LeakListener extends ClassLoaderLeakPreventor {
protected void debug(String s) {
log.fine(s);
}

protected void info(String s) {
log.info(s);
}

protected void warn(String s) {
log.warning(s);
}

protected void warn(Throwable t) {
log.log(Level.WARNING, "", t);
}

protected void error(String s) {
log.severe(s);
}

protected void error(Throwable t) {
log.log(Level.SEVERE, "", t);
}

}
2 changes: 1 addition & 1 deletion zanata-war/src/main/webapp-jboss/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@

<!-- ClassLoaderLeakPreventor needs to be first, so that it can stop all leaks -->
<listener>
<listener-class>se.jiderhamn.classloader.leak.prevention.ClassLoaderLeakPreventor</listener-class>
<listener-class>org.zanata.servlet.LeakListener</listener-class>
</listener>

<listener>
Expand Down

0 comments on commit ac00fcb

Please sign in to comment.