293739 - Deprecate static Jetty Log usage in favor of named logs

+ Finished conversion of the rest of jetty 7.x
This commit is contained in:
Joakim Erdfelt 2011-08-24 13:14:28 -07:00
parent 3399242d83
commit f6d45d5650
27 changed files with 165 additions and 81 deletions

View File

@ -19,6 +19,7 @@ import org.eclipse.jetty.server.handler.DefaultHandler;
import org.eclipse.jetty.server.handler.HandlerList;
import org.eclipse.jetty.server.handler.ResourceHandler;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
/* ------------------------------------------------------------ */
/** Simple Jetty FileServer.
@ -33,6 +34,8 @@ import org.eclipse.jetty.util.log.Log;
*/
public class FileServer
{
private static final Logger LOG = Log.getLogger(FileServer.class);
public static void main(String[] args) throws Exception
{
Server server = new Server(args.length == 0?8080:Integer.parseInt(args[0]));
@ -42,7 +45,7 @@ public class FileServer
resource_handler.setWelcomeFiles(new String[]{ "index.html" });
resource_handler.setResourceBase(args.length == 2?args[1]:".");
Log.info("serving " + resource_handler.getBaseResource());
LOG.info("serving " + resource_handler.getBaseResource());
HandlerList handlers = new HandlerList();
handlers.setHandlers(new Handler[] { resource_handler, new DefaultHandler() });

View File

@ -28,6 +28,7 @@ import java.util.jar.JarEntry;
import org.eclipse.jetty.util.Loader;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.resource.Resource;
import org.eclipse.jetty.webapp.JarScanner;
import org.objectweb.asm.AnnotationVisitor;
@ -44,6 +45,8 @@ import org.objectweb.asm.commons.EmptyVisitor;
*/
public class AnnotationParser
{
private static final Logger LOG = Log.getLogger(AnnotationParser.class);
protected List<String> _parsedClassNames = new ArrayList<String>();
protected Map<String, List<DiscoverableAnnotationHandler>> _annotationHandlers = new HashMap<String, List<DiscoverableAnnotationHandler>>();
protected List<ClassHandler> _classHandlers = new ArrayList<ClassHandler>();
@ -528,7 +531,7 @@ public class AnnotationParser
}
catch (Exception ex)
{
Log.warn(Log.EXCEPTION,ex);
LOG.warn(Log.EXCEPTION,ex);
}
}
}
@ -574,7 +577,7 @@ public class AnnotationParser
}
catch (Exception e)
{
Log.warn("Problem processing jar entry "+entry, e);
LOG.warn("Problem processing jar entry "+entry, e);
}
}
@ -619,7 +622,7 @@ public class AnnotationParser
}
catch (Exception e)
{
Log.warn("Problem processing jar entry "+entry, e);
LOG.warn("Problem processing jar entry "+entry, e);
}
}

View File

@ -18,6 +18,7 @@ import java.util.List;
import org.eclipse.jetty.annotations.AnnotationParser.ClassHandler;
import org.eclipse.jetty.util.MultiMap;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
/**
* ClassInheritanceHandler
@ -26,6 +27,8 @@ import org.eclipse.jetty.util.log.Log;
*/
public class ClassInheritanceHandler implements ClassHandler
{
private static final Logger LOG = Log.getLogger(ClassInheritanceHandler.class);
MultiMap _inheritanceMap = new MultiMap();
@ -47,7 +50,7 @@ public class ClassInheritanceHandler implements ClassHandler
}
catch (Exception e)
{
Log.warn(e);
LOG.warn(e);
}
}

View File

@ -26,11 +26,14 @@ import org.eclipse.jetty.annotations.AnnotationIntrospector.AbstractIntrospectab
import org.eclipse.jetty.plus.annotation.Injection;
import org.eclipse.jetty.plus.annotation.InjectionCollection;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.webapp.MetaData;
import org.eclipse.jetty.webapp.WebAppContext;
public class ResourceAnnotationHandler extends AbstractIntrospectableAnnotationHandler
{
private static final Logger LOG = Log.getLogger(ResourceAnnotationHandler.class);
protected WebAppContext _context;
@ -84,7 +87,7 @@ public class ResourceAnnotationHandler extends AbstractIntrospectableAnnotationH
}
catch (NamingException e)
{
Log.warn(e);
LOG.warn(e);
}
}
}
@ -97,14 +100,14 @@ public class ResourceAnnotationHandler extends AbstractIntrospectableAnnotationH
//JavaEE Spec 5.2.3: Field cannot be static
if (Modifier.isStatic(field.getModifiers()))
{
Log.warn("Skipping Resource annotation on "+clazz.getName()+"."+field.getName()+": cannot be static");
LOG.warn("Skipping Resource annotation on "+clazz.getName()+"."+field.getName()+": cannot be static");
return;
}
//JavaEE Spec 5.2.3: Field cannot be final
if (Modifier.isFinal(field.getModifiers()))
{
Log.warn("Skipping Resource annotation on "+clazz.getName()+"."+field.getName()+": cannot be final");
LOG.warn("Skipping Resource annotation on "+clazz.getName()+"."+field.getName()+": cannot be final");
return;
}
@ -165,7 +168,7 @@ public class ResourceAnnotationHandler extends AbstractIntrospectableAnnotationH
//Check there is a JNDI entry for this annotation
if (bound)
{
Log.debug("Bound "+(mappedName==null?name:mappedName) + " as "+ name);
LOG.debug("Bound "+(mappedName==null?name:mappedName) + " as "+ name);
// Make the Injection for it if the binding succeeded
injection = new Injection();
injection.setTarget(clazz, field, type);
@ -230,7 +233,7 @@ public class ResourceAnnotationHandler extends AbstractIntrospectableAnnotationH
//JavaEE Spec 5.2.3: Method cannot be static
if (Modifier.isStatic(method.getModifiers()))
{
Log.warn("Skipping Resource annotation on "+clazz.getName()+"."+method.getName()+": cannot be static");
LOG.warn("Skipping Resource annotation on "+clazz.getName()+"."+method.getName()+": cannot be static");
return;
}
@ -238,19 +241,19 @@ public class ResourceAnnotationHandler extends AbstractIntrospectableAnnotationH
// only 1 parameter
if (!method.getName().startsWith("set"))
{
Log.warn("Skipping Resource annotation on "+clazz.getName()+"."+method.getName()+": invalid java bean, does not start with 'set'");
LOG.warn("Skipping Resource annotation on "+clazz.getName()+"."+method.getName()+": invalid java bean, does not start with 'set'");
return;
}
if (method.getParameterTypes().length != 1)
{
Log.warn("Skipping Resource annotation on "+clazz.getName()+"."+method.getName()+": invalid java bean, not single argument to method");
LOG.warn("Skipping Resource annotation on "+clazz.getName()+"."+method.getName()+": invalid java bean, not single argument to method");
return;
}
if (Void.TYPE != method.getReturnType())
{
Log.warn("Skipping Resource annotation on "+clazz.getName()+"."+method.getName()+": invalid java bean, not void");
LOG.warn("Skipping Resource annotation on "+clazz.getName()+"."+method.getName()+": invalid java bean, not void");
return;
}
@ -320,7 +323,7 @@ public class ResourceAnnotationHandler extends AbstractIntrospectableAnnotationH
if (bound)
{
Log.debug("Bound "+(mappedName==null?name:mappedName) + " as "+ name);
LOG.debug("Bound "+(mappedName==null?name:mappedName) + " as "+ name);
// Make the Injection for it
injection = new Injection();
injection.setTarget(clazz, method,paramType,resourceType);

View File

@ -19,10 +19,13 @@ import javax.naming.NamingException;
import org.eclipse.jetty.annotations.AnnotationIntrospector.AbstractIntrospectableAnnotationHandler;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.webapp.WebAppContext;
public class ResourcesAnnotationHandler extends AbstractIntrospectableAnnotationHandler
{
private static final Logger LOG = Log.getLogger(ResourcesAnnotationHandler.class);
protected WebAppContext _wac;
@ -40,7 +43,7 @@ public class ResourcesAnnotationHandler extends AbstractIntrospectableAnnotation
Resource[] resArray = resources.value();
if (resArray==null||resArray.length==0)
{
Log.warn ("Skipping empty or incorrect Resources annotation on "+clazz.getName());
LOG.warn ("Skipping empty or incorrect Resources annotation on "+clazz.getName());
return;
}
@ -62,11 +65,11 @@ public class ResourcesAnnotationHandler extends AbstractIntrospectableAnnotation
if (!org.eclipse.jetty.plus.jndi.NamingEntryUtil.bindToENC(_wac, name, mappedName))
if (!org.eclipse.jetty.plus.jndi.NamingEntryUtil.bindToENC(_wac.getServer(), name, mappedName))
Log.warn("Skipping Resources(Resource) annotation on "+clazz.getName()+" for name "+name+": No resource bound at "+(mappedName==null?name:mappedName));
LOG.warn("Skipping Resources(Resource) annotation on "+clazz.getName()+" for name "+name+": No resource bound at "+(mappedName==null?name:mappedName));
}
catch (NamingException e)
{
Log.warn(e);
LOG.warn(e);
}
}
}

View File

@ -22,6 +22,7 @@ import org.eclipse.jetty.annotations.AnnotationParser.Value;
import org.eclipse.jetty.plus.annotation.RunAsCollection;
import org.eclipse.jetty.servlet.ServletHolder;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.webapp.Descriptor;
import org.eclipse.jetty.webapp.MetaData;
import org.eclipse.jetty.webapp.WebAppContext;
@ -29,6 +30,8 @@ import org.eclipse.jetty.webapp.WebAppContext;
public class RunAsAnnotationHandler extends AbstractIntrospectableAnnotationHandler
{
private static final Logger LOG = Log.getLogger(RunAsAnnotationHandler.class);
protected WebAppContext _context;
public RunAsAnnotationHandler (WebAppContext wac)
@ -74,7 +77,7 @@ public class RunAsAnnotationHandler extends AbstractIntrospectableAnnotationHand
}
}
else
Log.warn("Bad value for @RunAs annotation on class "+clazz.getName());
LOG.warn("Bad value for @RunAs annotation on class "+clazz.getName());
}
}
@ -82,13 +85,13 @@ public class RunAsAnnotationHandler extends AbstractIntrospectableAnnotationHand
public void handleField(String className, String fieldName, int access, String fieldType, String signature, Object value, String annotation,
List<Value> values)
{
Log.warn ("@RunAs annotation not applicable for fields: "+className+"."+fieldName);
LOG.warn ("@RunAs annotation not applicable for fields: "+className+"."+fieldName);
}
public void handleMethod(String className, String methodName, int access, String params, String signature, String[] exceptions, String annotation,
List<Value> values)
{
Log.warn("@RunAs annotation ignored on method: "+className+"."+methodName+" "+signature);
LOG.warn("@RunAs annotation ignored on method: "+className+"."+methodName+" "+signature);
}
private ServletHolder getServletHolderForClass (Class clazz)

View File

@ -27,11 +27,14 @@ import org.eclipse.jetty.util.component.AbstractLifeCycle;
import org.eclipse.jetty.util.component.Dumpable;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.log.Logger;
/* ------------------------------------------------------------ */
public class ThreadMonitor extends AbstractLifeCycle implements Runnable
{
private static final Logger LOG = Log.getLogger(ThreadMonitor.class);
private int _scanInterval;
private int _logInterval;
private int _busyThreshold;
@ -296,7 +299,7 @@ public class ThreadMonitor extends AbstractLifeCycle implements Runnable
_runner.setDaemon(true);
_runner.start();
Log.info("Thread Monitor started successfully");
LOG.info("Thread Monitor started successfully");
}
/* ------------------------------------------------------------ */
@ -395,7 +398,7 @@ public class ThreadMonitor extends AbstractLifeCycle implements Runnable
}
catch (InterruptedException ex)
{
Log.ignore(ex);
LOG.ignore(ex);
}
}
}
@ -486,7 +489,7 @@ public class ThreadMonitor extends AbstractLifeCycle implements Runnable
}
catch (Exception ex)
{
Log.debug(ex);
LOG.debug(ex);
}
return repeat;
}

View File

@ -25,9 +25,12 @@ import org.eclipse.jetty.io.Buffers;
import org.eclipse.jetty.io.EndPoint;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
public class NestedGenerator extends AbstractGenerator
{
private static final Logger LOG = Log.getLogger(NestedGenerator.class);
final HttpServletResponse _response;
final String _nestedIn;
@ -40,7 +43,7 @@ public class NestedGenerator extends AbstractGenerator
public void addContent(Buffer content, boolean last) throws IOException
{
// Log.debug("addContent {} {}",content.length(),last);
// LOG.debug("addContent {} {}",content.length(),last);
if (_noContent)
{
content.clear();
@ -52,7 +55,7 @@ public class NestedGenerator extends AbstractGenerator
if (_last || _state == STATE_END)
{
Log.debug("Ignoring extra content {}", content);
LOG.debug("Ignoring extra content {}", content);
content.clear();
return;
}
@ -107,7 +110,7 @@ public class NestedGenerator extends AbstractGenerator
public boolean addContent(byte b) throws IOException
{
// Log.debug("addContent 1");
// LOG.debug("addContent 1");
if (_noContent)
return false;
@ -150,7 +153,7 @@ public class NestedGenerator extends AbstractGenerator
{
if (_buffer == null)
{
// Log.debug("initContent");
// LOG.debug("initContent");
_buffer = _buffers.getBuffer();
}
}
@ -181,8 +184,8 @@ public class NestedGenerator extends AbstractGenerator
@Override
public void completeHeader(HttpFields fields, boolean allContentAdded) throws IOException
{
if (Log.isDebugEnabled())
Log.debug("completeHeader: {}",fields.toString().trim().replace("\r\n","|"));
if (LOG.isDebugEnabled())
LOG.debug("completeHeader: {}",fields.toString().trim().replace("\r\n","|"));
if (_state != STATE_HEADER)
return;
@ -247,7 +250,7 @@ public class NestedGenerator extends AbstractGenerator
int size=_buffer.length();
int len = _buffer==null?0:_endp.flush(_buffer);
Log.debug("flushBuffer {} of {}",len,size);
LOG.debug("flushBuffer {} of {}",len,size);
if (len>0)
_buffer.skip(len);

View File

@ -28,6 +28,7 @@ import org.eclipse.jetty.nosql.NoSqlSessionManager;
import org.eclipse.jetty.server.SessionIdManager;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.log.Logger;
import org.omg.CORBA._IDLTypeStub;
import com.mongodb.BasicDBObject;
@ -37,6 +38,8 @@ import com.mongodb.MongoException;
public class MongoSessionManager extends NoSqlSessionManager
{
private static final Logger LOG = Log.getLogger(MongoSessionManager.class);
private final static Logger __log = Log.getLogger("org.eclipse.jetty.server.session");
/*
@ -184,7 +187,7 @@ public class MongoSessionManager extends NoSqlSessionManager
}
catch (Exception e)
{
Log.warn(e);
LOG.warn(e);
}
return null;
}
@ -265,7 +268,7 @@ public class MongoSessionManager extends NoSqlSessionManager
}
catch (Exception e)
{
Log.warn(e);
LOG.warn(e);
}
return null;
@ -325,7 +328,7 @@ public class MongoSessionManager extends NoSqlSessionManager
}
catch (Exception e)
{
Log.warn(e);
LOG.warn(e);
}
return null;
}

View File

@ -21,6 +21,7 @@ import java.util.LinkedHashSet;
import org.eclipse.jetty.osgi.boot.OSGiWebappConstants;
import org.eclipse.jetty.osgi.boot.utils.internal.DefaultFileLocatorHelper;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.resource.Resource;
import org.eclipse.jetty.webapp.TagLibConfiguration;
import org.eclipse.jetty.webapp.WebAppContext;
@ -45,6 +46,8 @@ import org.osgi.util.tracker.ServiceTracker;
*/
public class TagLibOSGiConfiguration extends TagLibConfiguration
{
private static final Logger LOG = Log.getLogger(TagLibOSGiConfiguration.class);
private ServiceTracker packageAdminServiceTracker = null;
/**
@ -128,7 +131,7 @@ public class TagLibOSGiConfiguration extends TagLibConfiguration
}
if (!atLeastOneTldFound)
{
Log.warn("No '/META-INF/*.tld' resources were found "
LOG.warn("No '/META-INF/*.tld' resources were found "
+ " in the bundle '" + bs[0].getSymbolicName()
+ "' while registering the "
+ OSGiWebappConstants.REQUIRE_TLD_BUNDLE

View File

@ -31,6 +31,7 @@ import org.eclipse.jetty.osgi.boot.utils.internal.PackageAdminServiceTracker;
import org.eclipse.jetty.server.handler.ContextHandler;
import org.eclipse.jetty.util.Scanner;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.resource.Resource;
import org.eclipse.jetty.webapp.WebAppContext;
import org.osgi.framework.Bundle;
@ -60,6 +61,8 @@ import org.osgi.framework.Constants;
*/
public class OSGiAppProvider extends ScanningAppProvider implements AppProvider
{
private static final Logger LOG = Log.getLogger(OSGiAppProvider.class);
private boolean _extractWars = true;
private boolean _parentLoaderPriority = false;
@ -190,6 +193,7 @@ public class OSGiAppProvider extends ScanningAppProvider implements AppProvider
/**
* @see AppProvider
*/
@Override
public void setDeploymentManager(DeploymentManager deploymentManager)
{
// _manager=deploymentManager;
@ -456,6 +460,7 @@ public class OSGiAppProvider extends ScanningAppProvider implements AppProvider
/**
* Overridden to install the OSGi bundles found in the monitored folder.
*/
@Override
protected void doStart() throws Exception
{
if (isAutoInstallOSGiBundles())
@ -463,7 +468,7 @@ public class OSGiAppProvider extends ScanningAppProvider implements AppProvider
if (getMonitoredDirResource() == null)
{
setAutoInstallOSGiBundles(false);
Log.info("Disable autoInstallOSGiBundles as there is not contexts folder to monitor.");
LOG.info("Disable autoInstallOSGiBundles as there is not contexts folder to monitor.");
}
else
{
@ -474,14 +479,14 @@ public class OSGiAppProvider extends ScanningAppProvider implements AppProvider
if (!scandir.exists() || !scandir.isDirectory())
{
setAutoInstallOSGiBundles(false);
Log.warn("Disable autoInstallOSGiBundles as the contexts folder '" + scandir.getAbsolutePath() + " does not exist.");
LOG.warn("Disable autoInstallOSGiBundles as the contexts folder '" + scandir.getAbsolutePath() + " does not exist.");
scandir = null;
}
}
catch (IOException ioe)
{
setAutoInstallOSGiBundles(false);
Log.warn("Disable autoInstallOSGiBundles as the contexts folder '" + getMonitoredDirResource().getURI() + " does not exist.");
LOG.warn("Disable autoInstallOSGiBundles as the contexts folder '" + getMonitoredDirResource().getURI() + " does not exist.");
scandir = null;
}
if (scandir != null)
@ -610,7 +615,7 @@ public class OSGiAppProvider extends ScanningAppProvider implements AppProvider
{
//not sure we will ever be here,
//most likely a BundleException was thrown
Log.warn("The file " + location + " is not an OSGi bundle.");
LOG.warn("The file " + location + " is not an OSGi bundle.");
return null;
}
if (start && b.getHeaders().get(Constants.FRAGMENT_HOST) == null)
@ -633,7 +638,7 @@ public class OSGiAppProvider extends ScanningAppProvider implements AppProvider
}
catch (BundleException e)
{
Log.warn("Unable to " + (start? "start":"install") + " the bundle " + file.getAbsolutePath(), e);
LOG.warn("Unable to " + (start? "start":"install") + " the bundle " + file.getAbsolutePath(), e);
}
return null;
}
@ -648,7 +653,7 @@ public class OSGiAppProvider extends ScanningAppProvider implements AppProvider
}
catch (BundleException e)
{
Log.warn("Unable to uninstall the bundle " + file.getAbsolutePath(), e);
LOG.warn("Unable to uninstall the bundle " + file.getAbsolutePath(), e);
}
}
@ -672,7 +677,7 @@ public class OSGiAppProvider extends ScanningAppProvider implements AppProvider
}
catch (BundleException e)
{
Log.warn("Unable to update the bundle " + file.getAbsolutePath(), e);
LOG.warn("Unable to update the bundle " + file.getAbsolutePath(), e);
}
}
@ -684,6 +689,8 @@ public class OSGiAppProvider extends ScanningAppProvider implements AppProvider
*/
class AutoStartWhenFrameworkHasCompleted implements Scanner.ScanCycleListener
{
private static final Logger LOG = Log.getLogger(AutoStartWhenFrameworkHasCompleted.class);
private final OSGiAppProvider _appProvider;
AutoStartWhenFrameworkHasCompleted(OSGiAppProvider appProvider)
@ -713,7 +720,7 @@ class AutoStartWhenFrameworkHasCompleted implements Scanner.ScanCycleListener
}
catch (BundleException e)
{
Log.warn("Unable to start the bundle " + b.getLocation(), e);
LOG.warn("Unable to start the bundle " + b.getLocation(), e);
}
}

View File

@ -27,6 +27,7 @@ import org.eclipse.jetty.osgi.boot.OSGiServerConstants;
import org.eclipse.jetty.osgi.boot.utils.BundleFileLocatorHelper;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
@ -36,6 +37,8 @@ import org.osgi.framework.BundleContext;
* then setup the corresponding jetty server and starts it.
*/
public class DefaultJettyAtJettyHomeHelper {
private static final Logger LOG = Log.getLogger(DefaultJettyAtJettyHomeHelper.class);
/**
* contains a comma separated list of pathes to the etc/jetty-*.xml files
@ -101,13 +104,13 @@ public class DefaultJettyAtJettyHomeHelper {
}
if (jettyHomeBundleSysProp != null)
{
Log.warn("Both the jetty.home property and the jetty.home.bundle property are defined."
LOG.warn("Both the jetty.home property and the jetty.home.bundle property are defined."
+ " jetty.home.bundle is not taken into account.");
}
jettyHome = new File(jettyHomeSysProp);
if (!jettyHome.exists() || !jettyHome.isDirectory())
{
Log.warn("Unable to locate the jetty.home folder " + jettyHomeSysProp);
LOG.warn("Unable to locate the jetty.home folder " + jettyHomeSysProp);
return;
}
}
@ -124,14 +127,14 @@ public class DefaultJettyAtJettyHomeHelper {
}
if (jettyHomeBundle == null)
{
Log.warn("Unable to find the jetty.home.bundle named " + jettyHomeSysProp);
LOG.warn("Unable to find the jetty.home.bundle named " + jettyHomeSysProp);
return;
}
}
if (jettyHome == null && jettyHomeBundle == null)
{
Log.warn("No default jetty started.");
LOG.warn("No default jetty started.");
return;
}
try
@ -143,7 +146,7 @@ public class DefaultJettyAtJettyHomeHelper {
String configURLs = jettyHome != null ? getJettyConfigurationURLs(jettyHome) : getJettyConfigurationURLs(jettyHomeBundle);
properties.put(OSGiServerConstants.MANAGED_JETTY_XML_CONFIG_URLS, configURLs);
Log.info("Configuring the default jetty server with " + configURLs);
LOG.info("Configuring the default jetty server with " + configURLs);
//these properties usually are the ones passed to this type of configuration.
setProperty(properties,SYS_PROP_JETTY_HOME,System.getProperty(SYS_PROP_JETTY_HOME));

View File

@ -18,6 +18,7 @@ import java.util.Dictionary;
import org.eclipse.jetty.osgi.boot.JettyBootstrapActivator;
import org.eclipse.jetty.osgi.boot.OSGiWebappConstants;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleEvent;
import org.osgi.util.tracker.BundleTracker;
@ -49,6 +50,8 @@ import org.osgi.util.tracker.BundleTrackerCustomizer;
* @author hmalphettes
*/
public class WebBundleTrackerCustomizer implements BundleTrackerCustomizer {
private static final Logger LOG = Log.getLogger(WebBundleTrackerCustomizer.class);
/**
@ -152,7 +155,7 @@ public class WebBundleTrackerCustomizer implements BundleTrackerCustomizer {
String contextPath = getWebContextPath(bundle, dic, false);//(String)dic.get(OSGiWebappConstants.RFC66_WEB_CONTEXTPATH);
if (contextPath == null || !contextPath.startsWith("/"))
{
Log.warn("The manifest header '" + OSGiWebappConstants.JETTY_WAR_FOLDER_PATH +
LOG.warn("The manifest header '" + OSGiWebappConstants.JETTY_WAR_FOLDER_PATH +
": " + warFolderRelativePath + "' in the bundle " + bundle.getSymbolicName() +
" is not valid: there is no Web-ContextPath defined in the manifest.");
return false;
@ -166,7 +169,7 @@ public class WebBundleTrackerCustomizer implements BundleTrackerCustomizer {
}
catch (Throwable e)
{
Log.warn("Starting the web-bundle " + bundle.getSymbolicName() + " threw an exception.", e);
LOG.warn("Starting the web-bundle " + bundle.getSymbolicName() + " threw an exception.", e);
return true;//maybe it did not work maybe it did. safer to track this bundle.
}
}

View File

@ -20,6 +20,7 @@ import org.eclipse.jetty.osgi.equinoxtools.console.EquinoxConsoleSyncServlet;
import org.eclipse.jetty.osgi.equinoxtools.console.EquinoxConsoleWebSocketServlet;
import org.eclipse.jetty.osgi.equinoxtools.console.WebConsoleSession;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.osgi.framework.console.ConsoleSession;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
@ -34,6 +35,8 @@ import org.osgi.util.tracker.ServiceTrackerCustomizer;
*/
public class WebEquinoxToolsActivator implements BundleActivator
{
private static final Logger LOG = Log.getLogger(WebEquinoxToolsActivator.class);
private static BundleContext context;
public static BundleContext getContext()
@ -95,11 +98,11 @@ public class WebEquinoxToolsActivator implements BundleActivator
}
catch (ServletException e)
{
Log.warn(e);
LOG.warn(e);
}
catch (NamespaceException e)
{
Log.warn(e);
LOG.warn(e);
}
return _httpService;
}

View File

@ -24,6 +24,7 @@ import javax.servlet.http.HttpServletResponse;
import org.eclipse.jetty.osgi.equinoxtools.WebEquinoxToolsActivator;
import org.eclipse.jetty.osgi.equinoxtools.console.WebConsoleWriterOutputStream.OnFlushListener;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.websocket.WebSocket;
import org.eclipse.jetty.websocket.WebSocketServlet;
import org.eclipse.osgi.framework.console.ConsoleSession;
@ -34,6 +35,8 @@ import org.eclipse.osgi.framework.console.ConsoleSession;
*/
public class EquinoxConsoleWebSocketServlet extends WebSocketServlet implements OnFlushListener
{
private static final Logger LOG = Log.getLogger(EquinoxConsoleWebSocketServlet.class);
private final Set<ChatWebSocket> _members = new CopyOnWriteArraySet<ChatWebSocket>();
private static final long serialVersionUID = 1L;
private WebConsoleSession _consoleSession;
@ -93,19 +96,19 @@ public class EquinoxConsoleWebSocketServlet extends WebSocketServlet implements
public void onOpen(Connection connection)
{
// Log.info(this+" onConnect");
// LOG.info(this+" onConnect");
_connection=connection;
_members.add(this);
}
public void onMessage(byte frame, byte[] data,int offset, int length)
{
// Log.info(this+" onMessage: "+TypeUtil.toHexString(data,offset,length));
// LOG.info(this+" onMessage: "+TypeUtil.toHexString(data,offset,length));
}
public void onMessage(String data)
{
Log.info("onMessage: {}",data);
LOG.info("onMessage: {}",data);
if (data.indexOf("disconnect")>=0)
_connection.disconnect();
else
@ -129,14 +132,14 @@ public class EquinoxConsoleWebSocketServlet extends WebSocketServlet implements
{
_username = data.substring(0, data.length()-":has joined!".length());
}
// Log.info(this+" onMessage: "+data);
// LOG.info(this+" onMessage: "+data);
onFlush();
}
}
public void onClose(int code, String message)
{
// Log.info(this+" onDisconnect");
// LOG.info(this+" onDisconnect");
_members.remove(this);
}
@ -165,7 +168,7 @@ public class EquinoxConsoleWebSocketServlet extends WebSocketServlet implements
}
catch(IOException e)
{
Log.warn(e);
LOG.warn(e);
}
}
}

View File

@ -52,6 +52,7 @@ import javax.sql.DataSource;
//import org.eclipse.jetty.http.HttpHeaders;
//import org.eclipse.jetty.util.StringUtil;
//import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
@ -61,6 +62,8 @@ import javax.sql.DataSource;
*/
public class Dump extends HttpServlet
{
private static final Logger LOG = Log.getLogger(Dump.class);
boolean fixed;
/* ------------------------------------------------------------ */
@ -211,7 +214,7 @@ public class Dump extends HttpServlet
}
catch (IOException e)
{
Log.ignore(e);
LOG.ignore(e);
}
}

View File

@ -36,6 +36,7 @@ import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.security.CertificateValidator;
@ -60,6 +61,8 @@ import org.eclipse.jetty.util.security.CertificateValidator;
*/
public class JettyPolicy extends Policy
{
private static final Logger LOG = Log.getLogger(JettyPolicy.class);
private static boolean __DEBUG = false;
private static boolean __RELOAD = false;
@ -363,7 +366,7 @@ public class JettyPolicy extends Policy
{
try
{
Log.info(message);
LOG.info(message);
}
catch ( AccessControlException ace )
{
@ -396,7 +399,7 @@ public class JettyPolicy extends Policy
{
try
{
Log.info(message, t);
LOG.info(message, t);
}
catch ( AccessControlException ace )
{

View File

@ -23,6 +23,7 @@ import org.eclipse.jetty.server.HttpConnection;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.util.LazyList;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
/**
* Base container to group rules. Can be extended so that the contained rules
@ -33,6 +34,8 @@ import org.eclipse.jetty.util.log.Log;
public class RuleContainer extends Rule
{
private static final Logger LOG = Log.getLogger(RuleContainer.class);
protected Rule[] _rules;
protected String _originalPathAttribute;
@ -194,10 +197,10 @@ public class RuleContainer extends Rule
String applied=rule.matchAndApply(target,request, response);
if (applied!=null)
{
Log.debug("applied {}",rule);
LOG.debug("applied {}",rule);
if (!target.equals(applied))
{
Log.debug("rewrote {} to {}",target,applied);
LOG.debug("rewrote {} to {}",target,applied);
if (!original_set)
{
original_set=true;
@ -220,13 +223,13 @@ public class RuleContainer extends Rule
if (rule.isHandling())
{
Log.debug("handling {}",rule);
LOG.debug("handling {}",rule);
(request instanceof Request?(Request)request:HttpConnection.getCurrentConnection().getRequest()).setHandled(true);
}
if (rule.isTerminating())
{
Log.debug("terminating {}",rule);
LOG.debug("terminating {}",rule);
break;
}
}

View File

@ -42,6 +42,8 @@ import java.util.Map;
*/
public class UrlEncoded extends MultiMap
{
// private static final Logger LOG = Log.getLogger(UrlEncoded.class);
public static final String ENCODING = System.getProperty("org.eclipse.jetty.util.UrlEncoding.charset",StringUtil.__UTF8);
/* ----------------------------------------------------------------- */
@ -811,7 +813,7 @@ public class UrlEncoded extends MultiMap
}
catch(UnsupportedEncodingException e)
{
// Log.warn(LogSupport.EXCEPTION,e);
// LOG.warn(LogSupport.EXCEPTION,e);
bytes=string.getBytes();
}
@ -861,7 +863,7 @@ public class UrlEncoded extends MultiMap
}
catch(UnsupportedEncodingException e)
{
// Log.warn(LogSupport.EXCEPTION,e);
// LOG.warn(LogSupport.EXCEPTION,e);
return new String(encoded,0,n);
}
}

View File

@ -48,6 +48,7 @@ import org.eclipse.jetty.continuation.ContinuationSupport;
import org.eclipse.jetty.http.HttpHeaders;
import org.eclipse.jetty.util.StringUtil;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
@ -57,6 +58,8 @@ import org.eclipse.jetty.util.log.Log;
*/
public class Dump extends HttpServlet
{
private static final Logger LOG = Log.getLogger(Dump.class);
boolean fixed;
/* ------------------------------------------------------------ */
@ -207,7 +210,7 @@ public class Dump extends HttpServlet
}
catch (IOException e)
{
Log.ignore(e);
LOG.ignore(e);
}
}

View File

@ -27,6 +27,7 @@ import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletResponseWrapper;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
/* ------------------------------------------------------------ */
@ -36,6 +37,8 @@ import org.eclipse.jetty.util.log.Log;
*/
public class DispatchServlet extends HttpServlet
{
private static final Logger LOG = Log.getLogger(DispatchServlet.class);
/* ------------------------------------------------------------ */
String pageType;
@ -156,7 +159,7 @@ public class DispatchServlet extends HttpServlet
}
catch(IOException e)
{
Log.ignore(e);
LOG.ignore(e);
}
}
else

View File

@ -51,6 +51,7 @@ import org.eclipse.jetty.http.HttpHeaders;
import org.eclipse.jetty.util.IO;
import org.eclipse.jetty.util.StringUtil;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
@ -60,6 +61,8 @@ import org.eclipse.jetty.util.log.Log;
*/
public class Dump extends HttpServlet
{
private static final Logger LOG = Log.getLogger(Dump.class);
boolean fixed;
/* ------------------------------------------------------------ */
@ -240,7 +243,7 @@ public class Dump extends HttpServlet
}
catch (IOException e)
{
Log.ignore(e);
LOG.ignore(e);
}
}

View File

@ -29,6 +29,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
/* ------------------------------------------------------------ */
@ -37,6 +38,8 @@ import org.eclipse.jetty.util.log.Log;
*/
public class SecureModeServlet extends HttpServlet
{
private static final Logger LOG = Log.getLogger(SecureModeServlet.class);
/* ------------------------------------------------------------ */
@Override
public void init(ServletConfig config) throws ServletException
@ -118,7 +121,7 @@ public class SecureModeServlet extends HttpServlet
try
{
out.println("check ability to log<br/>");
Log.info("testing logging");
LOG.info("testing logging");
out.println("status: <b>SUCCESS - expected</b><br/>");
}
catch (SecurityException e)

View File

@ -30,6 +30,7 @@ import javax.servlet.http.HttpServletRequestWrapper;
import javax.servlet.http.HttpServletResponse;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
/* ------------------------------------------------------------ */
/** TestFilter.
@ -41,6 +42,8 @@ import org.eclipse.jetty.util.log.Log;
*/
public class TestFilter implements Filter
{
private static final Logger LOG = Log.getLogger(TestFilter.class);
private boolean _remote;
private ServletContext _context;
private final Set<String> _allowed = new HashSet<String>();
@ -56,7 +59,7 @@ public class TestFilter implements Filter
_allowed.add("/favicon.ico");
_allowed.add("/jetty_banner.gif");
Log.debug("TestFilter#remote="+_remote);
LOG.debug("TestFilter#remote="+_remote);
}
/* ------------------------------------------------------------ */

View File

@ -10,11 +10,14 @@ import javax.servlet.http.HttpServletResponse;
import org.eclipse.jetty.util.TypeUtil;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.websocket.WebSocket;
import org.eclipse.jetty.websocket.WebSocketServlet;
public class WebSocketChatServlet extends WebSocketServlet
{
private static final Logger LOG = Log.getLogger(WebSocketChatServlet.class);
private final Set<ChatWebSocket> _members = new CopyOnWriteArraySet<ChatWebSocket>();
@Override
@ -37,14 +40,14 @@ public class WebSocketChatServlet extends WebSocketServlet
public void onOpen(Connection connection)
{
// Log.info(this+" onConnect");
// LOG.info(this+" onConnect");
_connection=connection;
_members.add(this);
}
public void onMessage(byte frame, byte[] data,int offset, int length)
{
// Log.info(this+" onMessage: "+TypeUtil.toHexString(data,offset,length));
// LOG.info(this+" onMessage: "+TypeUtil.toHexString(data,offset,length));
}
public void onMessage(String data)
@ -53,7 +56,7 @@ public class WebSocketChatServlet extends WebSocketServlet
_connection.disconnect();
else
{
// Log.info(this+" onMessage: "+data);
// LOG.info(this+" onMessage: "+data);
for (ChatWebSocket member : _members)
{
try
@ -62,7 +65,7 @@ public class WebSocketChatServlet extends WebSocketServlet
}
catch(IOException e)
{
Log.warn(e);
LOG.warn(e);
}
}
}
@ -70,7 +73,7 @@ public class WebSocketChatServlet extends WebSocketServlet
public void onClose(int code, String message)
{
// Log.info(this+" onDisconnect");
// LOG.info(this+" onDisconnect");
_members.remove(this);
}

View File

@ -41,6 +41,7 @@ import org.eclipse.jetty.server.nio.SelectChannelConnector;
import org.eclipse.jetty.server.session.HashSessionManager;
import org.eclipse.jetty.server.ssl.SslSelectChannelConnector;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.log.StdErrLog;
import org.eclipse.jetty.util.thread.QueuedThreadPool;
import org.eclipse.jetty.webapp.WebAppContext;
@ -49,6 +50,8 @@ import org.junit.Ignore;
@Ignore("Not a test case")
public class TestServer
{
private static final Logger LOG = Log.getLogger(TestServer.class);
public static void main(String[] args) throws Exception
{
((StdErrLog)Log.getLog()).setSource(false);
@ -189,7 +192,7 @@ public class TestServer
}
catch(Exception e)
{
Log.warn(e);
LOG.warn(e);
}
}
}.start();

View File

@ -30,12 +30,15 @@ import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
/**
* An HTTPS Socket Impl
*/
public class HttpsSocketImpl implements HttpSocket
{
private static final Logger LOG = Log.getLogger(HttpsSocketImpl.class);
private SSLContext sslContext;
private SSLSocketFactory sslfactory;
@ -66,7 +69,7 @@ public class HttpsSocketImpl implements HttpSocket
{
public boolean verify(String urlHostName, SSLSession session)
{
Log.warn("Warning: URL Host: " + urlHostName + " vs." + session.getPeerHost());
LOG.warn("Warning: URL Host: " + urlHostName + " vs." + session.getPeerHost());
return true;
}
};