001: /*
002: * JBoss, Home of Professional Open Source.
003: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
004: * as indicated by the @author tags. See the copyright.txt file in the
005: * distribution for a full listing of individual contributors.
006: *
007: * This is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU Lesser General Public License as
009: * published by the Free Software Foundation; either version 2.1 of
010: * the License, or (at your option) any later version.
011: *
012: * This software is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this software; if not, write to the Free
019: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021: */
022: package org.jboss.logging;
023:
024: import java.io.IOException;
025: import java.net.MalformedURLException;
026: import java.net.URL;
027:
028: import javax.management.ObjectName;
029:
030: import org.jboss.mx.util.ObjectNameFactory;
031: import org.jboss.system.ServiceMBean;
032:
033: /**
034: * MBean interface.
035: */
036: public interface Log4jServiceMBean extends ServiceMBean {
037: /** The default object name */
038: ObjectName OBJECT_NAME = ObjectNameFactory
039: .create("jboss.system:type=Log4jService,service=Logging");
040:
041: /** Notification type used to indicate a log4j reconfiguration */
042: String RECONFIGURE_NOTIFICATION_TYPE = "jboss.logging.log4j.reconfigure";
043:
044: // Attributes ----------------------------------------------------
045:
046: /**
047: * The catch <tt>System.out</tt> flag.
048: * @param flag True to enable, false to disable.
049: */
050: void setCatchSystemOut(boolean flag);
051:
052: boolean getCatchSystemOut();
053:
054: /**
055: * The catch <tt>System.err</tt> flag.
056: * @param flag True to enable, false to disable.
057: */
058: void setCatchSystemErr(boolean flag);
059:
060: boolean getCatchSystemErr();
061:
062: /**
063: * The org.apache.log4j.helpers.LogLog.setQuietMode flag
064: * @return True if enabled, false if disabled.
065: */
066: void setLog4jQuietMode(boolean flag);
067:
068: boolean getLog4jQuietMode();
069:
070: /**
071: * The refresh period.
072: */
073: void setRefreshPeriod(int refreshPeriod);
074:
075: int getRefreshPeriod();
076:
077: /**
078: * The Log4j configuration URL.
079: */
080: void setConfigurationURL(URL url);
081:
082: URL getConfigurationURL();
083:
084: // Operations ----------------------------------------------------
085:
086: /**
087: * Sets the level for a logger of the give name.
088: * <p>Values are trimmed before used.
089: *
090: * @param name The name of the logger to change level
091: * @param levelName The name of the level to change the logger to.
092: */
093: void setLoggerLevel(String name, String levelName);
094:
095: /**
096: * Sets the levels of each logger specified by the given comma seperated list of logger names.
097: * @see #setLoggerLevel
098: *
099: * @param list A comma seperated list of logger names.
100: * @param levelName The name of the level to change the logger to.
101: */
102: void setLoggerLevels(String list, String levelName);
103:
104: /**
105: * Gets the level of the logger of the give name.
106: *
107: * @param name The name of the logger to inspect.
108: */
109: String getLoggerLevel(String name);
110:
111: /**
112: * Force the logging system to reconfigure.
113: */
114: void reconfigure() throws IOException;
115:
116: /**
117: * Hack to reconfigure and change the URL. This is needed until
118: * we have a JMX HTML Adapter that can use PropertyEditor to coerce.
119: *
120: * @param url The new configuration url
121: */
122: void reconfigure(String url) throws IOException,
123: MalformedURLException;
124:
125: }
|