Java 类org.apache.commons.logging.impl.Jdk14Logger 实例源码
项目:alipay-sdk
文件:AlipayLogger.java
/**
* 开启DEBUG级别日志(仅针对JDK14LOGGER,LOG4J请自行修改配置文件)
*
* @param isEnabled
*/
public static void setJDKDebugEnabled(Boolean isEnabled) {
//如果使用JDK14LOGGER,将业务日志级别设为DEBUG(FINE)
if (blog instanceof Jdk14Logger) {
Jdk14Logger logger = (Jdk14Logger) blog;
if (isEnabled) {
logger.getLogger().setLevel(Level.FINE);
Handler consoleHandler = new ConsoleHandler();
consoleHandler.setLevel(Level.FINE);
logger.getLogger().addHandler(consoleHandler);
} else {
logger.getLogger().setLevel(Level.INFO);
}
}
}
项目:pay
文件:AlipayLogger.java
public static void setJDKDebugEnabled(Boolean isEnabled) {
//如果使用JDK14LOGGER,将业务日志级别设为DEBUG(FINE)
if (blog instanceof Jdk14Logger) {
Jdk14Logger logger = (Jdk14Logger) blog;
if (isEnabled) {
logger.getLogger().setLevel(Level.FINE);
Handler consoleHandler = new ConsoleHandler();
consoleHandler.setLevel(Level.FINE);
logger.getLogger().addHandler(consoleHandler);
} else {
logger.getLogger().setLevel(Level.INFO);
}
}
}
项目:ditb
文件:LogLevel.java
@Override
public void doGet(HttpServletRequest request, HttpServletResponse response
) throws ServletException, IOException {
// Do the authorization
if (!HttpServer.hasAdministratorAccess(getServletContext(), request,
response)) {
return;
}
PrintWriter out = ServletUtil.initHTML(response, "Log Level");
String logName = ServletUtil.getParameter(request, "log");
String level = ServletUtil.getParameter(request, "level");
if (logName != null) {
out.println("<br /><hr /><h3>Results</h3>");
out.println(MARKER
+ "Submitted Log Name: <b>" + logName + "</b><br />");
Log log = LogFactory.getLog(logName);
out.println(MARKER
+ "Log Class: <b>" + log.getClass().getName() +"</b><br />");
if (level != null) {
out.println(MARKER + "Submitted Level: <b>" + level + "</b><br />");
}
if (log instanceof Log4JLogger) {
process(((Log4JLogger)log).getLogger(), level, out);
}
else if (log instanceof Jdk14Logger) {
process(((Jdk14Logger)log).getLogger(), level, out);
}
else {
out.println("Sorry, " + log.getClass() + " not supported.<br />");
}
}
out.println(FORMS);
out.println(ServletUtil.HTML_TAIL);
}
项目:ditb
文件:HBaseTestingUtility.java
/**
* Switches the logger for the given class to DEBUG level.
*
* @param clazz The class for which to switch to debug logging.
*/
public void enableDebug(Class<?> clazz) {
Log l = LogFactory.getLog(clazz);
if (l instanceof Log4JLogger) {
((Log4JLogger) l).getLogger().setLevel(org.apache.log4j.Level.DEBUG);
} else if (l instanceof Jdk14Logger) {
((Jdk14Logger) l).getLogger().setLevel(java.util.logging.Level.ALL);
}
}
项目:LCIndex-HBase-0.94.16
文件:HBaseTestingUtility.java
/**
* Switches the logger for the given class to DEBUG level.
*
* @param clazz The class for which to switch to debug logging.
*/
public void enableDebug(Class<?> clazz) {
Log l = LogFactory.getLog(clazz);
if (l instanceof Log4JLogger) {
((Log4JLogger) l).getLogger().setLevel(org.apache.log4j.Level.DEBUG);
} else if (l instanceof Jdk14Logger) {
((Jdk14Logger) l).getLogger().setLevel(java.util.logging.Level.ALL);
}
}
项目:pbase
文件:LogLevel.java
@Override
public void doGet(HttpServletRequest request, HttpServletResponse response
) throws ServletException, IOException {
// Do the authorization
if (!HttpServer.hasAdministratorAccess(getServletContext(), request,
response)) {
return;
}
PrintWriter out = ServletUtil.initHTML(response, "Log Level");
String logName = ServletUtil.getParameter(request, "log");
String level = ServletUtil.getParameter(request, "level");
if (logName != null) {
out.println("<br /><hr /><h3>Results</h3>");
out.println(MARKER
+ "Submitted Log Name: <b>" + logName + "</b><br />");
Log log = LogFactory.getLog(logName);
out.println(MARKER
+ "Log Class: <b>" + log.getClass().getName() +"</b><br />");
if (level != null) {
out.println(MARKER + "Submitted Level: <b>" + level + "</b><br />");
}
if (log instanceof Log4JLogger) {
process(((Log4JLogger)log).getLogger(), level, out);
}
else if (log instanceof Jdk14Logger) {
process(((Jdk14Logger)log).getLogger(), level, out);
}
else {
out.println("Sorry, " + log.getClass() + " not supported.<br />");
}
}
out.println(FORMS);
out.println(ServletUtil.HTML_TAIL);
}
项目:pbase
文件:HBaseTestingUtility.java
/**
* Switches the logger for the given class to DEBUG level.
*
* @param clazz The class for which to switch to debug logging.
*/
public void enableDebug(Class<?> clazz) {
Log l = LogFactory.getLog(clazz);
if (l instanceof Log4JLogger) {
((Log4JLogger) l).getLogger().setLevel(org.apache.log4j.Level.DEBUG);
} else if (l instanceof Jdk14Logger) {
((Jdk14Logger) l).getLogger().setLevel(java.util.logging.Level.ALL);
}
}
项目:HIndex
文件:HBaseTestingUtility.java
/**
* Switches the logger for the given class to DEBUG level.
*
* @param clazz The class for which to switch to debug logging.
*/
public void enableDebug(Class<?> clazz) {
Log l = LogFactory.getLog(clazz);
if (l instanceof Log4JLogger) {
((Log4JLogger) l).getLogger().setLevel(org.apache.log4j.Level.DEBUG);
} else if (l instanceof Jdk14Logger) {
((Jdk14Logger) l).getLogger().setLevel(java.util.logging.Level.ALL);
}
}
项目:IRIndex
文件:HBaseTestingUtility.java
/**
* Switches the logger for the given class to DEBUG level.
*
* @param clazz The class for which to switch to debug logging.
*/
public void enableDebug(Class<?> clazz) {
Log l = LogFactory.getLog(clazz);
if (l instanceof Log4JLogger) {
((Log4JLogger) l).getLogger().setLevel(org.apache.log4j.Level.DEBUG);
} else if (l instanceof Jdk14Logger) {
((Jdk14Logger) l).getLogger().setLevel(java.util.logging.Level.ALL);
}
}
项目:hbase
文件:HBaseTestingUtility.java
/**
* Switches the logger for the given class to DEBUG level.
*
* @param clazz The class for which to switch to debug logging.
*/
public void enableDebug(Class<?> clazz) {
Logger l = LoggerFactory.getLogger(clazz);
if (l instanceof Log4JLogger) {
((Log4JLogger) l).getLogger().setLevel(org.apache.log4j.Level.DEBUG);
} else if (l instanceof Log4jLoggerAdapter) {
LogManager.getLogger(clazz).setLevel(org.apache.log4j.Level.DEBUG);
} else if (l instanceof Jdk14Logger) {
((Jdk14Logger) l).getLogger().setLevel(java.util.logging.Level.ALL);
}
}
项目:hbase
文件:LogLevel.java
@Override
public void doGet(HttpServletRequest request, HttpServletResponse response
) throws ServletException, IOException {
// Do the authorization
if (!HttpServer.hasAdministratorAccess(getServletContext(), request,
response)) {
return;
}
PrintWriter out = ServletUtil.initHTML(response, "Log Level");
String logName = ServletUtil.getParameter(request, "log");
String level = ServletUtil.getParameter(request, "level");
if (logName != null) {
out.println("<br /><hr /><h3>Results</h3>");
out.println(MARKER
+ "Submitted Log Name: <b>" + logName + "</b><br />");
Logger log = LoggerFactory.getLogger(logName);
out.println(MARKER
+ "Log Class: <b>" + log.getClass().getName() +"</b><br />");
if (level != null) {
out.println(MARKER + "Submitted Level: <b>" + level + "</b><br />");
}
if (log instanceof Log4JLogger) {
process(((Log4JLogger)log).getLogger(), level, out);
} else if (log instanceof Jdk14Logger) {
process(((Jdk14Logger)log).getLogger(), level, out);
} else if (log instanceof Log4jLoggerAdapter) {
process(LogManager.getLogger(logName), level, out);
} else {
out.println("Sorry, " + log.getClass() + " not supported.<br />");
}
}
out.println(FORMS);
out.println(ServletUtil.HTML_TAIL);
}
项目:PyroDB
文件:HBaseTestingUtility.java
/**
* Switches the logger for the given class to DEBUG level.
*
* @param clazz The class for which to switch to debug logging.
*/
public void enableDebug(Class<?> clazz) {
Log l = LogFactory.getLog(clazz);
if (l instanceof Log4JLogger) {
((Log4JLogger) l).getLogger().setLevel(org.apache.log4j.Level.DEBUG);
} else if (l instanceof Jdk14Logger) {
((Jdk14Logger) l).getLogger().setLevel(java.util.logging.Level.ALL);
}
}
项目:c5
文件:HBaseTestingUtility.java
/**
* Switches the logger for the given class to DEBUG level.
*
* @param clazz The class for which to switch to debug logging.
*/
public void enableDebug(Class<?> clazz) {
Log l = LogFactory.getLog(clazz);
if (l instanceof Log4JLogger) {
((Log4JLogger) l).getLogger().setLevel(org.apache.log4j.Level.DEBUG);
} else if (l instanceof Jdk14Logger) {
((Jdk14Logger) l).getLogger().setLevel(java.util.logging.Level.ALL);
}
}
项目:wandora
文件:ModulesServlet.java
@Override
public void init(ServletConfig config) throws ServletException {
super.init(config);
moduleManager=new ModuleManager();
servletHome=config.getServletContext().getRealPath("/")+"WEB-INF";
moduleManager.setVariable("servletHome", servletHome);
// SimpleLog log=new SimpleLog("ModulesServlet");
// log.setLevel(SimpleLog.LOG_LEVEL_DEBUG);
Log log=new Jdk14Logger("ModulesServlet");
moduleManager.setLogging(log);
String configFile=config.getInitParameter("modulesconfig");
if(configFile==null) {
configFile=config.getInitParameter("modulesConfig");
if(configFile==null) configFile="modulesconfig.xml";
}
bindAddress=config.getInitParameter("bindaddress");
if(bindAddress==null){
bindAddress=config.getInitParameter("bindAddress");
}
moduleManager.addModule(servletModule,new ModuleSettings("rootServlet"));
moduleManager.readXMLOptionsFile(configFile);
if(bindAddress==null){
bindAddress=moduleManager.getVariable("bindAddress");
if(bindAddress==null) bindAddress=DEFAULT_BIND_ADDRESS;
}
try{
moduleManager.autostartModules();
}catch(ModuleException me){
throw new ServletException("Unable to start modules.",me);
}
}
项目:wandora
文件:WandoraModulesServer.java
public WandoraModulesServer(Wandora wandora){
this.wandora = wandora;
jettyServer = new Server();
rootLog = new Jdk14Logger("ModulesServlet");
log = rootLog;
Options options = wandora.getOptions();
readOptions(options);
mimeTypes = new MimeTypes();
initModuleManager();
readBundleDirectories();
}
项目:tomee
文件:AppDataSourceTest.java
@Test
public void run() throws OpenEJBException, NamingException, IOException {
final File tempWar = new File("target/AppDataSourceTest");
tempWar.mkdirs();
new File(tempWar, "WEB-INF").mkdirs();
IO.writeString(new File(tempWar, "WEB-INF/resources.xml"),
"<resources>\n" +
"<Resource id=\"java:app/gace/MyDS\" type=\"DataSource\">\n" +
"DataSourceCreator=dbcp\n" +
"</Resource>\n" +
"</resources>\n");
final Collection<LogRecord> records = new ArrayList<>();
try (final Container c = new Container(new Configuration().randomHttpPort())) {
Jdk14Logger.class.cast(LogFactory.getLog(BasicDataSource.class)).getLogger().addHandler(new Handler() {
@Override
public void publish(final LogRecord record) {
if (record.getLevel() == Level.SEVERE || record.getLevel() == Level.WARNING) {
records.add(record);
}
}
@Override
public void flush() {
// no-op
}
@Override
public void close() throws SecurityException {
// no-op
}
});
c.deploy(null, tempWar);
}
// if we have the JMX bug of dbcp2 integration (in 7.0.0) then we have a WARNING record from BasicDataSource.close()
// saying:
// Failed to unregister the JMX name:
// Tomcat:type=DataSource,host=localhost,context=/AppDataSourceTest,class=javax.sql.DataSource,name="openejb/Resource/AppDataSourceTest/app/gace/MyDS"
assertTrue(records.isEmpty());
}
项目:HBase-Research
文件:HBaseTestingUtility.java
/**
* Switches the logger for the given class to DEBUG level.
*
* @param clazz The class for which to switch to debug logging.
*/
public void enableDebug(Class<?> clazz) {
Log l = LogFactory.getLog(clazz);
if (l instanceof Log4JLogger) {
((Log4JLogger) l).getLogger().setLevel(org.apache.log4j.Level.DEBUG);
} else if (l instanceof Jdk14Logger) {
((Jdk14Logger) l).getLogger().setLevel(java.util.logging.Level.ALL);
}
}
项目:hbase-0.94.8-qod
文件:HBaseTestingUtility.java
/**
* Switches the logger for the given class to DEBUG level.
*
* @param clazz The class for which to switch to debug logging.
*/
public void enableDebug(Class<?> clazz) {
Log l = LogFactory.getLog(clazz);
if (l instanceof Log4JLogger) {
((Log4JLogger) l).getLogger().setLevel(org.apache.log4j.Level.DEBUG);
} else if (l instanceof Jdk14Logger) {
((Jdk14Logger) l).getLogger().setLevel(java.util.logging.Level.ALL);
}
}
项目:hbase-0.94.8-qod
文件:HBaseTestingUtility.java
/**
* Switches the logger for the given class to DEBUG level.
*
* @param clazz The class for which to switch to debug logging.
*/
public void enableDebug(Class<?> clazz) {
Log l = LogFactory.getLog(clazz);
if (l instanceof Log4JLogger) {
((Log4JLogger) l).getLogger().setLevel(org.apache.log4j.Level.DEBUG);
} else if (l instanceof Jdk14Logger) {
((Jdk14Logger) l).getLogger().setLevel(java.util.logging.Level.ALL);
}
}
项目:DominoHBase
文件:HBaseTestingUtility.java
/**
* Switches the logger for the given class to DEBUG level.
*
* @param clazz The class for which to switch to debug logging.
*/
public void enableDebug(Class<?> clazz) {
Log l = LogFactory.getLog(clazz);
if (l instanceof Log4JLogger) {
((Log4JLogger) l).getLogger().setLevel(org.apache.log4j.Level.DEBUG);
} else if (l instanceof Jdk14Logger) {
((Jdk14Logger) l).getLogger().setLevel(java.util.logging.Level.ALL);
}
}
项目:hindex
文件:HBaseTestingUtility.java
/**
* Switches the logger for the given class to DEBUG level.
*
* @param clazz The class for which to switch to debug logging.
*/
public void enableDebug(Class<?> clazz) {
Log l = LogFactory.getLog(clazz);
if (l instanceof Log4JLogger) {
((Log4JLogger) l).getLogger().setLevel(org.apache.log4j.Level.DEBUG);
} else if (l instanceof Jdk14Logger) {
((Jdk14Logger) l).getLogger().setLevel(java.util.logging.Level.ALL);
}
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot
文件:JavaLoggingSystemTests.java
@Before
public void init() throws SecurityException, IOException {
this.defaultLocale = Locale.getDefault();
Locale.setDefault(Locale.ENGLISH);
this.logger = new Jdk14Logger(getClass().getName());
}
项目:spring-boot-concourse
文件:JavaLoggingSystemTests.java
@Before
public void init() throws SecurityException, IOException {
this.defaultLocale = Locale.getDefault();
Locale.setDefault(Locale.ENGLISH);
this.logger = new Jdk14Logger(getClass().getName());
}
项目:contestparser
文件:JavaLoggingSystemTests.java
@Before
public void init() throws SecurityException, IOException {
this.defaultLocale = Locale.getDefault();
Locale.setDefault(Locale.ENGLISH);
this.logger = new Jdk14Logger(getClass().getName());
}