Skip to content

Commit

Permalink
Use SLF4J API for logging
Browse files Browse the repository at this point in the history
  • Loading branch information
rebecca0201 committed Aug 16, 2023
1 parent 9911d63 commit 17d07c0
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 9 deletions.
Binary file added dist/lib/ext/slf4j-api.jar
Binary file not shown.
Binary file added dist/lib/ext/slf4j-jdk14.jar
Binary file not shown.
Binary file modified dist/lib/zest-examples.war
Binary file not shown.
Binary file modified dist/lib/zest.jar
Binary file not shown.
1 change: 1 addition & 0 deletions doc/release-note
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
Upgrade Notes:
Update Java compiler source/target to 8
Update zweb to 9.6.0
Use SLF4J API for logging

-----
1.1.0
Expand Down
1 change: 1 addition & 0 deletions zest/classpath
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
../dist/lib/ext/zcommon.jar
../dist/lib/ext/zweb.jar
../dist/lib/ext/servlet-api.jar
../dist/lib/ext/slf4j-api.jar
11 changes: 11 additions & 0 deletions zest/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,17 @@
<version>2.3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.5</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
<version>1.7.5</version>
<scope>runtime</scope>
</dependency>
</dependencies>
<build>
<directory>${project.basedir}/debug</directory>
Expand Down
8 changes: 5 additions & 3 deletions zest/src/org/zkoss/zest/sys/ZestFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.zkoss.lang.Classes;
import org.zkoss.util.logging.Log;

import org.zkoss.zest.sys.Parser;
import org.zkoss.zest.sys.impl.ParserImpl;
Expand All @@ -40,7 +42,7 @@
* @author tomyeh
*/
public class ZestFilter implements Filter {
private static final Log log = Log.lookup(ZestManager.class);
private static final Logger log = LoggerFactory.getLogger(ZestManager.class);

private ZestManager _manager;

Expand Down Expand Up @@ -74,7 +76,7 @@ public final void init(FilterConfig config) throws ServletException {
_manager.init(ctx, parser);

if (oldManager != null)
log.warning(oldManager+" is replaced"+_manager);
log.warn(oldManager+" is replaced"+_manager);
}
private static Object newInstance(String clsnm, Class klass) throws ServletException {
final Object o;
Expand Down
6 changes: 4 additions & 2 deletions zest/src/org/zkoss/zest/sys/ZestManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.zkoss.lang.reflect.Fields;
import org.zkoss.util.logging.Log;
import org.zkoss.web.servlet.http.Https;
import org.zkoss.web.util.resource.ServletContextLocator;

Expand All @@ -44,7 +46,7 @@
* @author tomyeh
*/
public class ZestManager {
private static final Log log = Log.lookup(ZestManager.class);
private static final Logger log = LoggerFactory.getLogger(ZestManager.class);
private static final String ATTR_MANAGER = "org.zkoss.zest.sys.manager";

private ServletContext _ctx;
Expand Down
2 changes: 1 addition & 1 deletion zest/src/org/zkoss/zest/sys/impl/ActionDefinitionImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ else if (c instanceof String)
else
throw new ClassNotFoundException("Class expected in "+_klassV+", not "+c);
}
return klass.newInstance();
return klass.getDeclaredConstructor().newInstance();
}
public String execute(ActionContext ac, Object action) throws Exception {
final String mtdnm = (String)_method.getValue(ac);
Expand Down
8 changes: 5 additions & 3 deletions zest/src/org/zkoss/zest/sys/impl/ParserImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@
import java.util.HashMap;
import java.net.URL;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.zkoss.lang.Classes;
import org.zkoss.util.resource.Locator;
import org.zkoss.util.logging.Log;
import org.zkoss.idom.Document;
import org.zkoss.idom.Element;
import org.zkoss.idom.Item;
Expand All @@ -44,7 +46,7 @@
* @author tomyeh
*/
public class ParserImpl implements Parser {
private static final Log log = Log.lookup(ParserImpl.class);
private static final Logger log = LoggerFactory.getLogger(ParserImpl.class);

public ParserImpl() {
}
Expand All @@ -54,7 +56,7 @@ public Configuration parse(URL url, Locator loc) throws Exception {
try {
return parse(new SAXBuilder(true, false, true).build(url).getRootElement(), loc);
} catch (Throwable ex) {
log.realCauseBriefly("Failed to parse "+url, ex);
log.error("Failed to parse "+url, ex);
if (ex instanceof Error) throw (Error)ex;
throw (Exception)ex;
}
Expand Down

0 comments on commit 17d07c0

Please sign in to comment.