/** * Create a new AccessLoggerValve. * * @param parent MBean Name of the associated parent component * * @exception Exception if an MBean cannot be created or registered */ public String createAccessLoggerValve(String parent) throws Exception { ObjectName pname = new ObjectName(parent); // Create a new AccessLogValve instance AccessLogValve accessLogger = new AccessLogValve(); ContainerBase containerBase = getParentContainerFromParent(pname); // Add the new instance to its parent component containerBase.addValve(accessLogger); ObjectName oname = accessLogger.getObjectName(); return (oname.toString()); }
/** * Create a new AccessLoggerValve. * * @param parent MBean Name of the associated parent component * * @exception Exception if an MBean cannot be created or registered * * @deprecated Will be removed in Tomcat 8.0.x. Replaced by {@link * #createValve(String, String)}. */ @Deprecated public String createAccessLoggerValve(String parent) throws Exception { ObjectName pname = new ObjectName(parent); // Create a new AccessLogValve instance AccessLogValve accessLogger = new AccessLogValve(); ContainerBase containerBase = getParentContainerFromParent(pname); // Add the new instance to its parent component containerBase.getPipeline().addValve(accessLogger); ObjectName oname = accessLogger.getObjectName(); return (oname.toString()); }
/** * Create a new AccessLoggerValve. * * @param parent MBean Name of the associated parent component * * @exception Exception if an MBean cannot be created or registered * * @deprecated Will be removed in Tomcat 8.0.x. Replaced by {@link * #createValve(String, String)}. */ @Deprecated public String createAccessLoggerValve(String parent) throws Exception { ObjectName pname = new ObjectName(parent); // Create a new AccessLogValve instance AccessLogValve accessLogger = new AccessLogValve(); ContainerBase containerBase = getParentContainerFromParent(pname); // Add the new instance to its parent component containerBase.getPipeline().addValve(accessLogger); ObjectName oname = accessLogger.getObjectName(); return (oname.toString()); }
/** * Create a new AccessLoggerValve. * * @param parent MBean Name of the associated parent component * * @exception Exception if an MBean cannot be created or registered */ public String createAccessLoggerValve(String parent) throws Exception { ObjectName pname = new ObjectName(parent); // Create a new AccessLogValve instance AccessLogValve accessLogger = new AccessLogValve(); ContainerBase containerBase = getParentContainerFromParent(pname); // Add the new instance to its parent component containerBase.getPipeline().addValve(accessLogger); ObjectName oname = accessLogger.getObjectName(); return (oname.toString()); }
/** * Create a new AccessLoggerValve. * * @param parent MBean Name of the associated parent component * * @exception Exception if an MBean cannot be created or registered */ public String createAccessLoggerValve(String parent) throws Exception { ObjectName pname = new ObjectName(parent); // Create a new AccessLogValve instance AccessLogValve accessLogger = new AccessLogValve(); ContainerBase containerBase = getParentContainerFromParent(pname); // Add the new instance to its parent component containerBase.getPipeline().addValve(accessLogger); ObjectName oname = accessLogger.getObjectName(); return (oname.toString()); }
/** * Create a new AccessLoggerValve. * * @param parent MBean Name of the associated parent component * * @exception Exception if an MBean cannot be created or registered */ public String createAccessLoggerValve(String parent) throws Exception { ObjectName pname = new ObjectName(parent); // Create a new AccessLogValve instance AccessLogValve accessLogger = new AccessLogValve(); ContainerBase containerBase = getParentContainerFromParent(pname); // Add the new instance to its parent component containerBase.getPipeline().addValve(accessLogger); ObjectName oname = accessLogger.getObjectName(); return (oname.toString()); }
private void addAccessLog(Tomcat httpServer, StandardContext context) { try { String accessLogLocation = serverData.getRootContext().getBean(AccessLogLocationBean.class).getAccessLogLocation(); accessLogLocation = accessLogLocation + "/" + replaceSlash(serverData.getModule().getContext()) + "-access.log"; AccessLogValve accessLogValve = new AccessLogValve(); accessLogValve.setDirectory(accessLogLocation); accessLogValve.setPattern(Constants.AccessLog.COMMON_ALIAS); accessLogValve.setSuffix(".log"); accessLogValve.setRotatable(true); context.getPipeline().addValve(accessLogValve); } catch (Exception e) { logger.error(InternalErrorCode.SERVER_STARTUP_FAILED_TO_CREATE_ACCESS_LOG.toString() + ": " + e.getMessage()); if (e.getCause() != null) logger.error("CAUSED BY: " + InternalErrorCode.SERVER_STARTUP_FAILED_TO_CREATE_ACCESS_LOG.toString() + ": " + e.getCause().getMessage()); } }
protected void setupAccessLogIfNeeds(Context ctx) { if (accessLogOption != null && ctx instanceof StandardContext) { // also check context type just in case final StandardContext stdctx = (StandardContext) ctx; final AccessLogValve valve = new AccessLogValve(); accessLogOption.getLogDir().ifPresent(dir -> valve.setDirectory(dir)); accessLogOption.getFilePrefix().ifPresent(prefix -> valve.setPrefix(prefix)); accessLogOption.getFileSuffix().ifPresent(suffix -> valve.setSuffix(suffix)); accessLogOption.getFileDateFormat().ifPresent(format -> valve.setFileDateFormat(format)); valve.setEncoding(accessLogOption.getFileEncoding().orElse("UTF-8")); valve.setPattern(accessLogOption.getFormatPattern().orElse("common")); accessLogOption.getConditionIf().ifPresent(cond -> valve.setConditionIf(cond)); accessLogOption.getConditionUnless().ifPresent(cond -> valve.setConditionUnless(cond)); stdctx.addValve(valve); } }
AccessLogValve accessLogValve = new AccessLogValve();
factory.addContextValves(remoteIpValve); AccessLogValve accessLogValve = new AccessLogValve(); accessLogValve.setEnabled(accessLogEnabled); accessLogValve.setBuffered(false);
AccessLogValve alv = new AccessLogValve(); alv.setDirectory( new File( extractDirectory, "logs" ).getAbsolutePath() ); alv.setPattern( runtimeProperties.getProperty( Tomcat8Runner.ACCESS_LOG_VALVE_FORMAT_KEY ) );
AccessLogValve alv = new AccessLogValve(); alv.setDirectory( new File( extractDirectory, "logs" ).getAbsolutePath() ); alv.setPattern( runtimeProperties.getProperty( Tomcat7Runner.ACCESS_LOG_VALVE_FORMAT_KEY ) );
AccessLogValve alv = new AccessLogValve(); alv.setDirectory( new File( extractDirectory, "logs" ).getAbsolutePath() ); alv.setPattern( runtimeProperties.getProperty( Tomcat7Runner.ACCESS_LOG_VALVE_FORMAT_KEY ) );
AccessLogValve alv = new AccessLogValve(); alv.setDirectory( new File( configurationDir, "logs" ).getAbsolutePath() ); alv.setPattern( "%h %l %u %t \"%r\" %s %b %I %D" );
AccessLogValve alv = new AccessLogValve(); alv.setDirectory( new File( configurationDir, "logs" ).getAbsolutePath() ); alv.setPattern( "%h %l %u %t \"%r\" %s %b %I %D" );
private void configEngine(Engine engine, TomcatConf tomcatConf) { engine.setBackgroundProcessorDelay(tomcatConf.getBackgroundProcessorDelay()); if (tomcatConf.isAccessLogEnabled()) { AccessLogValve value = new AccessLogValve(); value.setBuffered(tomcatConf.isAccessLogBuffered()); value.setFileDateFormat(tomcatConf.getAccessLogFileFormat()); value.setRequestAttributesEnabled(tomcatConf.isAccessLogRequestAttributesEnabled()); value.setPattern(tomcatConf.getAccessLogPattern()); engine.getPipeline().addValve(value); } }