Thomas,

If you just want to change logging levels then I have attached a jsp that
will allow this, I think there is a property that you can pass in like -
Dlog4j.config=/path/to/file or something like that.

Don

On 2/7/07, Thomas Chang <[EMAIL PROTECTED]> wrote:

Hi all,

I am not sure if my question is put in a right place. Hope there is
someone who can give me some info.

I have a file called "mylog.log4j.properties" - not "log4j.properties".
Normally I should put this file under WEB-INF and it will be packaged in to
the WAR. But I want to put this logfile outside of the WAR so it will be
easy to change its contents without open the WAR.

But I don't know where should I put this logfile so my web-application
will write the logs into it. I've heard I have to configue the classpath, or
I have to configure the web.xml. But how?

------------------------------
Jetzt Mails schnell in einem Vorschaufenster überfliegen. Dies und viel
mehr bietet das neue Yahoo! Mail
<http://de.rd.yahoo.com/evt=40589/*http://de.docs.yahoo.com/ymail/landing.html+%0A>
.


Title: Log4J Administration
<%@ page language="java" contentType="text/html;charset=UTF-8"%> <%@ page import="org.apache.log4j.Level"%> <%@ page import="org.apache.log4j.LogManager"%> <%@ page import="org.apache.log4j.Logger, java.util.*"%> <% long beginPageLoadTime = System.currentTimeMillis();%> <% String containsFilter = "Contains"; String beginsWithFilter = "Begins With"; String[] logLevels = { "debug", "info", "warn", "error", "fatal", "off" }; String targetOperation = (String)request.getParameter("operation"); String targetLogger = (String)request.getParameter("logger"); String targetLogLevel = (String)request.getParameter("newLogLevel"); String logNameFilter = (String)request.getParameter("logNameFilter"); String logNameFilterType = (String)request.getParameter("logNameFilterType"); %>

Log4J Administration

Filter Loggers:   " class="filterText" /> " class="filterButton" />  " class="filterButton" /> 
<% Enumeration loggers = LogManager.getCurrentLoggers(); HashMap loggersMap = new HashMap(128); Logger rootLogger = LogManager.getRootLogger(); if(!loggersMap.containsKey(rootLogger.getName())) { loggersMap.put(rootLogger.getName(), rootLogger); } while(loggers.hasMoreElements()) { Logger logger = (Logger)loggers.nextElement(); if(logNameFilter == null || logNameFilter.trim().length() == 0) { loggersMap.put(logger.getName(), logger); } else if(containsFilter.equals(logNameFilterType)) { if(logger.getName().toUpperCase().indexOf(logNameFilter.toUpperCase()) >= 0) { loggersMap.put(logger.getName(), logger); } } else { // Either was no filter in IF, contains filter in ELSE IF, or begins with in ELSE if(logger.getName().startsWith(logNameFilter)) { loggersMap.put(logger.getName(), logger); } } } Set loggerKeys = loggersMap.keySet(); String[] keys = new String[loggerKeys.size()]; keys = (String[])loggerKeys.toArray(keys); Arrays.sort(keys, String.CASE_INSENSITIVE_ORDER); for(int i=0; i <% } %>
Logger Parent Logger Effective Level Change Log Level To
<%=loggerName%> <%=loggerParent%> <%=loggerEffectiveLevel%> <% for(int cnt=0; cnt [<%=logLevels[cnt].toUpperCase()%>] <% } else { %> [<%=logLevels[cnt]%>]  <% } } %>

Don Hill
Gemlogic, Inc.
Email: [EMAIL PROTECTED]
Revision: 1.0
Page Load Time (Millis): <%=(System.currentTimeMillis() - beginPageLoadTime)%>

Reply via email to