Author: musachy
Date: Tue May 13 09:03:04 2008
New Revision: 655931
URL: http://svn.apache.org/viewvc?rev=655931&view=rev
Log:
Use xwork logging instead of jdk logging
Modified:
struts/sandbox/trunk/struts2-convention-plugin/pom.xml
struts/sandbox/trunk/struts2-convention-plugin/src/main/java/org/apache/struts2/convention/AbstractClassLoaderResolver.java
struts/sandbox/trunk/struts2-convention-plugin/src/main/java/org/apache/struts2/convention/ClassClassLoaderResolver.java
struts/sandbox/trunk/struts2-convention-plugin/src/main/java/org/apache/struts2/convention/ConventionUnknownHandler.java
struts/sandbox/trunk/struts2-convention-plugin/src/main/java/org/apache/struts2/convention/DefaultResultMapBuilder.java
struts/sandbox/trunk/struts2-convention-plugin/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java
struts/sandbox/trunk/struts2-convention-plugin/src/main/java/org/apache/struts2/convention/SEOActionNameBuilder.java
Modified: struts/sandbox/trunk/struts2-convention-plugin/pom.xml
URL:
http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-convention-plugin/pom.xml?rev=655931&r1=655930&r2=655931&view=diff
==============================================================================
--- struts/sandbox/trunk/struts2-convention-plugin/pom.xml (original)
+++ struts/sandbox/trunk/struts2-convention-plugin/pom.xml Tue May 13 09:03:04
2008
@@ -27,7 +27,7 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-plugins</artifactId>
- <version>2.1.1-SNAPSHOT</version>
+ <version>2.1.3-SNAPSHOT</version>
</parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-convention-plugin</artifactId>
Modified:
struts/sandbox/trunk/struts2-convention-plugin/src/main/java/org/apache/struts2/convention/AbstractClassLoaderResolver.java
URL:
http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-convention-plugin/src/main/java/org/apache/struts2/convention/AbstractClassLoaderResolver.java?rev=655931&r1=655930&r2=655931&view=diff
==============================================================================
---
struts/sandbox/trunk/struts2-convention-plugin/src/main/java/org/apache/struts2/convention/AbstractClassLoaderResolver.java
(original)
+++
struts/sandbox/trunk/struts2-convention-plugin/src/main/java/org/apache/struts2/convention/AbstractClassLoaderResolver.java
Tue May 13 09:03:04 2008
@@ -36,8 +36,9 @@
import java.util.Set;
import java.util.jar.JarEntry;
import java.util.jar.JarInputStream;
-import java.util.logging.Level;
-import java.util.logging.Logger;
+
+import com.opensymphony.xwork2.util.logging.Logger;
+import com.opensymphony.xwork2.util.logging.LoggerFactory;
/**
* This class is maintained in the Java.net Commons library and the test cases
@@ -51,7 +52,7 @@
* </p>
*/
public abstract class AbstractClassLoaderResolver<T> {
- private static final Logger logger =
Logger.getLogger(AbstractClassLoaderResolver.class.getName());
+ private static final Logger LOG =
LoggerFactory.getLogger(AbstractClassLoaderResolver.class);
/**
* The set of matches being accumulated.
@@ -234,7 +235,8 @@
}
}
} catch (IOException ioe) {
- logger.log(Level.WARNING, "Could not read ClassPath entries",
ioe);
+ if (LOG.isErrorEnabled())
+ LOG.error("Could not read ClassPath entries", ioe);
}
}
@@ -274,7 +276,8 @@
loadResourcesInJar(test, recursive, baseURLSpec, dirName,
file);
}
} catch (IOException ioe) {
- logger.log(Level.WARNING, "Could not read ClassPath entries",
ioe);
+ if (LOG.isErrorEnabled())
+ LOG.error("Could not read ClassPath entries", ioe);
}
}
}
@@ -283,8 +286,8 @@
ClassLoader loader = getClassLoader();
List<URL> urls = new ArrayList<URL>();
for (String dirName : dirNames) {
- if (logger.isLoggable(Level.FINEST)) {
- logger.finest("Looking up resources in directory [" + dirName
+ "]");
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("Looking up resources in directory [#0]", dirName);
}
try {
@@ -294,7 +297,8 @@
urls.add(url);
}
} catch (IOException ioe) {
- logger.log(Level.WARNING, "Could not read driectory [" +
dirName + "]", ioe);
+ if (LOG.isErrorEnabled())
+ LOG.error("Could not read driectory [#0]", ioe, dirName);
}
}
@@ -316,9 +320,8 @@
urlPath = urlPath.substring(0, index);
}
- if (logger.isLoggable(Level.FINE)) {
- logger.fine("Scanning for resources in [" + urlPath + "] matching
criteria [" +
- test + "]");
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("Scanning for resources in [#0] matching criteria [#1]",
urlPath, test.toString());
}
return urlPath;
@@ -382,10 +385,11 @@
while ((entry = jarStream.getNextJarEntry()) != null) {
String name = entry.getName();
- if (logger.isLoggable(Level.FINEST)) {
- logger.finest("Checking JAR entry [" + name + "] against
[" + dirName +
- "] where index of / is [" + name.indexOf('/',
dirName.length() + 1) +
- "] starting from [" + (dirName.length() + 1) + "]");
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("Checking JAR entry [#0] against [#1]" +
+ " where index of / is [#2] starting from [#3]",
+ name, dirName, String.valueOf(name.indexOf('/',
dirName.length() + 1)),
+ String.valueOf(dirName.length() + 1));
}
if (!entry.isDirectory() &&
@@ -400,8 +404,9 @@
}
}
} catch (IOException ioe) {
- logger.log(Level.WARNING, "Could not search jar file [" + jarfile
+ "] for classes " +
- "matching criteria [" + test + "] due to an IOException", ioe);
+ if (LOG.isErrorEnabled())
+ LOG.error("Could not search jar file [#0] for classes " +
+ "matching criteria [#1] due to an IOException", ioe,
jarfile.toString(), test.toString());
}
}
Modified:
struts/sandbox/trunk/struts2-convention-plugin/src/main/java/org/apache/struts2/convention/ClassClassLoaderResolver.java
URL:
http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-convention-plugin/src/main/java/org/apache/struts2/convention/ClassClassLoaderResolver.java?rev=655931&r1=655930&r2=655931&view=diff
==============================================================================
---
struts/sandbox/trunk/struts2-convention-plugin/src/main/java/org/apache/struts2/convention/ClassClassLoaderResolver.java
(original)
+++
struts/sandbox/trunk/struts2-convention-plugin/src/main/java/org/apache/struts2/convention/ClassClassLoaderResolver.java
Tue May 13 09:03:04 2008
@@ -22,8 +22,9 @@
import java.lang.annotation.Annotation;
import java.util.Arrays;
-import java.util.logging.Level;
-import java.util.logging.Logger;
+
+import com.opensymphony.xwork2.util.logging.Logger;
+import com.opensymphony.xwork2.util.logging.LoggerFactory;
/**
* This class is maintained in the Java.net Commons library and the test cases
@@ -47,7 +48,7 @@
* </p>
*/
public class ClassClassLoaderResolver extends
AbstractClassLoaderResolver<Class<?>> {
- private static final Logger logger =
Logger.getLogger(ClassClassLoaderResolver.class.getName());
+ private static final Logger LOG =
LoggerFactory.getLogger(ClassClassLoaderResolver.class);
/**
* A Test that checks to see if each class is assignable to the provided
class. Note
@@ -185,14 +186,14 @@
protected Class<?> prepare(String spec) {
try {
ClassLoader loader = getClassLoader();
- if (logger.isLoggable(Level.FINE)) {
- logger.fine("Converting resource [" + spec + "] to Class<?>");
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("Converting resource [#0] to Class<?>", spec);
}
return loader.loadClass(spec);
} catch (Throwable t) {
- logger.warning("Could not load class [" + spec + "] due to a [" +
t.getClass().getName() +
- "] with message [" + t.getMessage() + "]");
+ if (LOG.isErrorEnabled())
+ LOG.error("Could not load class [#0]", t, spec);
throw new IllegalArgumentException("Could not load class [" + spec
+ "]", t);
}
}
Modified:
struts/sandbox/trunk/struts2-convention-plugin/src/main/java/org/apache/struts2/convention/ConventionUnknownHandler.java
URL:
http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-convention-plugin/src/main/java/org/apache/struts2/convention/ConventionUnknownHandler.java?rev=655931&r1=655930&r2=655931&view=diff
==============================================================================
---
struts/sandbox/trunk/struts2-convention-plugin/src/main/java/org/apache/struts2/convention/ConventionUnknownHandler.java
(original)
+++
struts/sandbox/trunk/struts2-convention-plugin/src/main/java/org/apache/struts2/convention/ConventionUnknownHandler.java
Tue May 13 09:03:04 2008
@@ -24,8 +24,7 @@
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
-import java.util.logging.Level;
-import java.util.logging.Logger;
+
import javax.servlet.ServletContext;
import org.apache.struts2.util.ClassLoaderUtils;
@@ -44,6 +43,8 @@
import com.opensymphony.xwork2.config.entities.ResultConfig;
import com.opensymphony.xwork2.config.entities.ResultTypeConfig;
import com.opensymphony.xwork2.inject.Inject;
+import com.opensymphony.xwork2.util.logging.Logger;
+import com.opensymphony.xwork2.util.logging.LoggerFactory;
/**
* <p>
@@ -62,7 +63,7 @@
* </p>
*/
public class ConventionUnknownHandler implements UnknownHandler {
- private static final Logger logger =
Logger.getLogger(ConventionUnknownHandler.class.getName());
+ private static final Logger LOG =
LoggerFactory.getLogger(ConventionUnknownHandler.class);
protected Configuration configuration;
protected ObjectFactory objectFactory;
protected ServletContext servletContext;
@@ -138,22 +139,25 @@
if (!actionName.equals("") && redirectToSlash) {
ResultTypeConfig redirectResultTypeConfig =
parentPackage.getAllResultTypeConfigs().get("redirect");
String redirectNamespace = namespace + "/" + actionName;
- if (logger.isLoggable(Level.FINEST)) {
- logger.finest("Checking if there is an action named index
in the namespace [" +
- redirectNamespace + "]");
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("Checking if there is an action named index in
the namespace [#0]",
+ redirectNamespace);
}
actionConfig =
configuration.getRuntimeConfiguration().getActionConfig(redirectNamespace,
"index");
if (actionConfig != null) {
- logger.finest("Found action config");
+ if (LOG.isTraceEnabled())
+ LOG.trace("Found action config");
PackageConfig packageConfig =
configuration.getPackageConfig(actionConfig.getPackageName());
if
(redirectNamespace.equals(packageConfig.getNamespace())) {
- logger.finest("Action is not a default - redirecting");
+ if (LOG.isTraceEnabled())
+ LOG.trace("Action is not a default - redirecting");
return buildActionConfig(redirectNamespace + "/",
redirectResultTypeConfig);
}
- logger.finest("Action was a default - NOT redirecting");
+ if (LOG.isTraceEnabled())
+ LOG.trace("Action was a default - NOT redirecting");
}
if (resource != null) {
@@ -180,8 +184,8 @@
protected Resource findResource(Map<String, ResultTypeConfig>
resultsByExtension, String... parts) {
for (String ext : resultsByExtension.keySet()) {
String path = string(parts) + "." + ext;
- if (logger.isLoggable(Level.FINEST)) {
- logger.finest("Checking for [" + path + "].");
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("Checking for [#0]", path);
}
try {
@@ -189,8 +193,8 @@
return new Resource(path, ext);
}
} catch (MalformedURLException e) {
- logger.warning("Unable to parse path to the web application
resource [" + path +
- "] skipping...");
+ if (LOG.isErrorEnabled())
+ LOG.error("Unable to parse path to the web application
resource [#0] skipping...", path);
}
}
@@ -222,11 +226,11 @@
Map<String, ResultTypeConfig> resultsByExtension =
conventionsService.getResultTypesByExtension(parentPackage);
Result result = null;
for (String ext : resultsByExtension.keySet()) {
- if (logger.isLoggable(Level.FINEST)) {
+ if (LOG.isTraceEnabled()) {
String fqan = ns + "/" + actionName;
- logger.finest("Trying to locate the correct result for the FQ
action [" + fqan +
- "] with an file extension of [" + ext + "] in the
directory [" + pathPrefix + "] " +
- "and a result code of [" + resultCode + "]");
+ LOG.trace("Trying to locate the correct result for the FQ
action [#0]"
+ + " with an file extension of [#1] in the directory
[#2] " + "and a result code of [#3]",
+ fqan, ext, pathPrefix, resultCode);
}
String path = string(pathPrefix, actionName, "-", resultCode, "."
, ext);
@@ -265,9 +269,9 @@
// Try /idx/action/index.jsp
Map<String, ResultTypeConfig> resultsByExtension =
conventionsService.getResultTypesByExtension(pkg);
for (String ext : resultsByExtension.keySet()) {
- if (logger.isLoggable(Level.FINEST)) {
+ if (LOG.isTraceEnabled()) {
String fqan = ns + "/" + actionName;
- logger.finest("Checking for [" + fqan + "/" + "index." +
ext + "].");
+ LOG.trace("Checking for [#0/index.#1]", fqan, ext);
}
String path = string(pathPrefix, actionName, "/index", "-",
resultCode, ".", ext);
@@ -290,20 +294,28 @@
protected Result findResult(String path, String resultCode, String ext,
ActionContext actionContext,
Map<String, ResultTypeConfig> resultsByExtension) {
try {
- logger.finest("Checking ServletContext for [" + path + "]");
+ boolean traceEnabled = LOG.isTraceEnabled();
+ if (traceEnabled)
+ LOG.trace("Checking ServletContext for [#0]", path);
+
if (servletContext.getResource(path) != null) {
- logger.finest("Found");
+ if (traceEnabled)
+ LOG.trace("Found");
return buildResult(path, resultCode,
resultsByExtension.get(ext), actionContext);
}
- logger.finest("Checking ClasLoader for [" + path + "]");
+ if (traceEnabled)
+ LOG.trace("Checking ClasLoader for #0", path);
+
String classLoaderPath = path.startsWith("/") ? path.substring(1,
path.length()) : path;
if (ClassLoaderUtils.getResource(classLoaderPath, getClass()) !=
null) {
- logger.finest("Found");
+ if (traceEnabled)
+ LOG.trace("Found");
return buildResult(path, resultCode,
resultsByExtension.get(ext), actionContext);
}
} catch (MalformedURLException e) {
- logger.warning("Unable to parse template path: "+path+",
skipping...");
+ if (LOG.isErrorEnabled())
+ LOG.error("Unable to parse template path: [#0] skipping...",
path);
}
return null;
Modified:
struts/sandbox/trunk/struts2-convention-plugin/src/main/java/org/apache/struts2/convention/DefaultResultMapBuilder.java
URL:
http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-convention-plugin/src/main/java/org/apache/struts2/convention/DefaultResultMapBuilder.java?rev=655931&r1=655930&r2=655931&view=diff
==============================================================================
---
struts/sandbox/trunk/struts2-convention-plugin/src/main/java/org/apache/struts2/convention/DefaultResultMapBuilder.java
(original)
+++
struts/sandbox/trunk/struts2-convention-plugin/src/main/java/org/apache/struts2/convention/DefaultResultMapBuilder.java
Tue May 13 09:03:04 2008
@@ -26,8 +26,7 @@
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
-import java.util.logging.Level;
-import java.util.logging.Logger;
+
import javax.servlet.ServletContext;
import org.apache.struts2.convention.annotation.Result;
@@ -39,6 +38,8 @@
import com.opensymphony.xwork2.config.entities.ResultConfig;
import com.opensymphony.xwork2.config.entities.ResultTypeConfig;
import com.opensymphony.xwork2.inject.Inject;
+import com.opensymphony.xwork2.util.logging.Logger;
+import com.opensymphony.xwork2.util.logging.LoggerFactory;
/**
* <p>
@@ -108,7 +109,7 @@
* </table>
*/
public class DefaultResultMapBuilder implements ResultMapBuilder {
- private static final Logger logger =
Logger.getLogger(DefaultResultMapBuilder.class.getName());
+ private static final Logger LOG =
LoggerFactory.getLogger(DefaultResultMapBuilder.class);
private final ServletContext servletContext;
private Set<String> relativeResultTypes;
private ConventionsService conventionsService;
@@ -152,8 +153,8 @@
defaultResultPath = defaultResultPath + namespace;
}
- if (logger.isLoggable(Level.FINEST)) {
- logger.finest("Using final calculated namespace [" + namespace +
"]");
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("Using final calculated namespace [#0]", namespace);
}
// Add that ending slash for concatentation
@@ -202,9 +203,9 @@
protected void createFromResources(Class<?> actionClass, Map<String,
ResultConfig> results,
final String resultPath, final String resultPrefix, final String
actionName,
PackageConfig packageConfig, Map<String, ResultTypeConfig>
resultsByExtension) {
- if (logger.isLoggable(Level.FINEST)) {
- logger.finest("Searching for results in the Servlet container at
[" + resultPath +
- "] with result prefix of [" + resultPrefix + "]");
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("Searching for results in the Servlet container at [#0]"
+
+ " with result prefix of [#1]", resultPath,
resultPrefix);
}
// Build from web application using the ServletContext
@@ -212,8 +213,8 @@
Set<String> paths = servletContext.getResourcePaths(resultPath);
if (paths != null) {
for (String path : paths) {
- if (logger.isLoggable(Level.FINEST)) {
- logger.finest("Processing resource path [" + path + "]");
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("Processing resource path [#0]", path);
}
makeResults(actionClass, path, resultPrefix, results,
packageConfig, resultsByExtension);
@@ -223,9 +224,10 @@
// Building from the classpath
String classPathLocation = resultPath.startsWith("/") ?
resultPath.substring(1, resultPath.length()) : resultPath;
- if (logger.isLoggable(Level.FINEST)) {
- logger.finest("Searching for results in the class path at [" +
classPathLocation +
- "] with a result prefix of [" + resultPrefix + "] and action
name [" + actionName + "]");
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("Searching for results in the class path at [#0]"
+ + " with a result prefix of [#1] and action name [#2]",
classPathLocation, resultPrefix,
+ actionName);
}
URLClassLoaderResolver resolver = new URLClassLoaderResolver();
@@ -240,8 +242,8 @@
Set<URL> matches = resolver.getMatches();
for (URL match : matches) {
- if (logger.isLoggable(Level.FINEST)) {
- logger.finest("Processing URL [" + match + "]");
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("Processing URL [#0]", match.toString());
}
String urlStr = match.toString();
@@ -270,10 +272,10 @@
// This case is when the path doesn't contain a result code
if (indexOfDot == resultPrefix.length()) {
- if (logger.isLoggable(Level.FINEST)) {
- logger.finest("The result file [" + path + "] has no
result code and therefore" +
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("The result file [#0] has no result code and
therefore" +
" will be associated with success, input and error by
default. This might" +
- " be overridden by another result file or an
annotation.");
+ " be overridden by another result file or an
annotation.", path);
}
if (!results.containsKey(Action.SUCCESS)) {
@@ -297,9 +299,9 @@
// This case is when the path contains a result code
} else if (indexOfDot > resultPrefix.length()) {
- if (logger.isLoggable(Level.FINEST)) {
- logger.finest("The result file [" + path + "] has a result
code and therefore" +
- " will be associated with only that result code.");
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("The result file [#0] has a result code and
therefore" +
+ " will be associated with only that result code.",
path);
}
String resultCode = path.substring(resultPrefix.length() + 1,
indexOfDot);
@@ -387,8 +389,8 @@
String key = parms[i];
String value = parms[i + 1];
map.put(key, value);
- if (logger.isLoggable(Level.FINEST)) {
- logger.finest("Adding parmeter ["+ key + ":" + value + "] to
result.");
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("Adding parmeter [#0:#1] to result", key, value);
}
}
Modified:
struts/sandbox/trunk/struts2-convention-plugin/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java
URL:
http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-convention-plugin/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java?rev=655931&r1=655930&r2=655931&view=diff
==============================================================================
---
struts/sandbox/trunk/struts2-convention-plugin/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java
(original)
+++
struts/sandbox/trunk/struts2-convention-plugin/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java
Tue May 13 09:03:04 2008
@@ -30,8 +30,6 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.logging.Level;
-import java.util.logging.Logger;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Actions;
@@ -46,6 +44,8 @@
import com.opensymphony.xwork2.config.entities.PackageConfig;
import com.opensymphony.xwork2.config.entities.ResultConfig;
import com.opensymphony.xwork2.inject.Inject;
+import com.opensymphony.xwork2.util.logging.Logger;
+import com.opensymphony.xwork2.util.logging.LoggerFactory;
/**
* <p>
@@ -53,7 +53,7 @@
* </p>
*/
public class PackageBasedActionConfigBuilder implements ActionConfigBuilder {
- private static final Logger logger =
Logger.getLogger(PackageBasedActionConfigBuilder.class.getName());
+ private static final Logger LOG =
LoggerFactory.getLogger(PackageBasedActionConfigBuilder.class);
private final Configuration configuration;
private final ActionNameBuilder actionNameBuilder;
private final ResultMapBuilder resultMapBuilder;
@@ -93,8 +93,8 @@
this.objectFactory = objectFactory;
this.redirectToSlash = Boolean.parseBoolean(redirectToSlash);
- if (logger.isLoggable(Level.FINEST)) {
- logger.finest("Setting action default parent package to [" +
defaultParentPackage + "]");
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("Setting action default parent package to [#0]",
defaultParentPackage);
}
this.defaultParentPackage = defaultParentPackage;
@@ -147,16 +147,16 @@
"[struts.convention.package.locators]");
}
- if (logger.isLoggable(Level.FINEST)) {
- logger.finest("Loading action configurations");
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("Loading action configurations");
if (actionPackages != null) {
- logger.finest("Actions being loaded from action packages " +
Arrays.asList(actionPackages));
+ LOG.trace("Actions being loaded from action packages " +
Arrays.asList(actionPackages));
}
if (packageLocators != null) {
- logger.finest("Actions being loaded using package locators " +
Arrays.asList(packageLocators));
+ LOG.trace("Actions being loaded using package locators " +
Arrays.asList(packageLocators));
}
if (excludePackages != null) {
- logger.finest("Excluding actions from packages " +
Arrays.asList(excludePackages));
+ LOG.trace("Excluding actions from packages " +
Arrays.asList(excludePackages));
}
}
@@ -217,9 +217,8 @@
// Determine the action package
String actionPackage = actionClass.getPackage().getName();
- if (logger.isLoggable(Level.FINEST)) {
- logger.finest("Processing class [" + actionClass.getName() +
"] in package [" +
- actionPackage + "]");
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("Processing class [#0] in package [#1]",
actionClass.getName(), actionPackage);
}
// Determine the default namespace and action name
@@ -301,9 +300,8 @@
// Check if there is a class or package level annotation for the
namespace
Namespace ns = AnnotationTools.findAnnotation(actionClass,
Namespace.class);
if (ns != null) {
- if (logger.isLoggable(Level.FINEST)) {
- logger.finest("Using non-default action namespace from
Namespace annotation of [" +
- ns.value() + "]");
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("Using non-default action namespace from Namespace
annotation of [#0]", ns.value());
}
return ns.value();
@@ -350,8 +348,8 @@
*/
protected String determineActionName(Class<?> actionClass) {
String actionName =
actionNameBuilder.build(actionClass.getSimpleName());
- if (logger.isLoggable(Level.FINEST)) {
- logger.finest("Got actionName for class [" + actionClass + "] of
[" + actionName + "]");
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("Got actionName for class [#0] of [#1]",
actionClass.toString(), actionName);
}
return actionName;
@@ -418,10 +416,9 @@
actionName, actionClass.getName());
actionConfig.methodName(actionMethod);
- if (logger.isLoggable(Level.FINEST)) {
- logger.finest("Creating action config for class [" + actionClass +
"], name [" + actionName +
- "] and package name [" + pkgCfg.getName() + "] in namespace ["
+ pkgCfg.getNamespace() +
- "]");
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("Creating action config for class [#0], name [#1] and
package name [#2] in namespace [#3]",
+ actionClass.toString(), actionName, pkgCfg.getName(),
pkgCfg.getNamespace());
}
Map<String, ResultConfig> results =
resultMapBuilder.build(actionClass, annotation, actionName, pkgCfg.build());
@@ -434,9 +431,8 @@
String actionNamespace, final String actionPackage, final Class<?>
actionClass,
Action action) {
if (action != null && !action.value().equals(Action.DEFAULT_VALUE)) {
- if (logger.isLoggable(Level.FINEST)) {
- logger.finest("Using non-default action namespace from the
Action annotation of [" +
- action.value() + "]");
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("Using non-default action namespace from the Action
annotation of [#0]", action.value());
}
actionNamespace = StringTools.upToLastToken(action.value(), "/");
}
@@ -445,8 +441,8 @@
ParentPackage parent = AnnotationTools.findAnnotation(actionClass,
ParentPackage.class);
String parentName = null;
if (parent != null) {
- if (logger.isLoggable(Level.FINEST)) {
- logger.finest("Using non-default parent package from
annotation of [" + parent.value() + "]");
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("Using non-default parent package from annotation of
[#0]", parent.value());
}
parentName = parent.value();
@@ -476,9 +472,8 @@
packageConfigs.put(name, pkgConfig);
}
- if (logger.isLoggable(Level.FINEST)) {
- logger.finest("Created package config named [" + name + "] with a
namespace [" +
- actionNamespace + "]");
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("Created package config named [#0] with a namespace
[#1]", name, actionNamespace);
}
return pkgConfig;
@@ -530,18 +525,18 @@
if
(parent.build().getAllActionConfigs().get(parentAction) == null) {
parent.addActionConfig(parentAction,
indexActionConfig);
}
- } else if (logger.isLoggable(Level.FINEST)) {
- logger.finest("The parent namespace [" +
parentNamespace + "] already contains " +
- "an action [" + parentAction + "]");
+ } else if (LOG.isTraceEnabled()) {
+ LOG.trace("The parent namespace [#0] already contains
" +
+ "an action [#1]", parentNamespace, parentAction);
}
}
}
// Step #3
if (pkgConfig.build().getAllActionConfigs().get("") == null) {
- if (logger.isLoggable(Level.FINEST)) {
- logger.finest("Creating index ActionConfig with an action
name of [] for the action " +
- "class [" + indexActionConfig.getClassName() + "]");
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("Creating index ActionConfig with an action name
of [] for the action " +
+ "class [#0]", indexActionConfig.getClassName());
}
pkgConfig.addActionConfig("", indexActionConfig);
Modified:
struts/sandbox/trunk/struts2-convention-plugin/src/main/java/org/apache/struts2/convention/SEOActionNameBuilder.java
URL:
http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-convention-plugin/src/main/java/org/apache/struts2/convention/SEOActionNameBuilder.java?rev=655931&r1=655930&r2=655931&view=diff
==============================================================================
---
struts/sandbox/trunk/struts2-convention-plugin/src/main/java/org/apache/struts2/convention/SEOActionNameBuilder.java
(original)
+++
struts/sandbox/trunk/struts2-convention-plugin/src/main/java/org/apache/struts2/convention/SEOActionNameBuilder.java
Tue May 13 09:03:04 2008
@@ -20,10 +20,9 @@
*/
package org.apache.struts2.convention;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
import com.opensymphony.xwork2.inject.Inject;
+import com.opensymphony.xwork2.util.logging.Logger;
+import com.opensymphony.xwork2.util.logging.LoggerFactory;
/**
* <p>
@@ -34,7 +33,7 @@
* </p>
*/
public class SEOActionNameBuilder implements ActionNameBuilder {
- private static final Logger logger =
Logger.getLogger(SEOActionNameBuilder.class.getName());
+ private static final Logger LOG =
LoggerFactory.getLogger(SEOActionNameBuilder.class);
private static final String ACTION = "Action";
private boolean lowerCase;
private String separator;
@@ -75,8 +74,8 @@
actionName = actionName.toLowerCase();
}
- if (logger.isLoggable(Level.FINEST)) {
- logger.finest("Changed action name from [" + className + "] to ["
+ actionName + "]");
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("Changed action name from [#0] to [#1]", className,
actionName);
}
return actionName;