Java Doc for Log4jConfigurer.java in  » J2EE » spring-framework-2.5 » org » springframework » util » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » J2EE » spring framework 2.5 » org.springframework.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.springframework.util.Log4jConfigurer

Log4jConfigurer
abstract public class Log4jConfigurer (Code)
Convenience class that features simple methods for custom Log4J configuration.

Only needed for non-default Log4J initialization, for example with a custom config location or a refresh interval. By default, Log4J will simply read its configuration from a "log4j.properties" file in the root of the class path.

For web environments, the analogous Log4jWebConfigurer class can be found in the web package, reading in its configuration from context-params in web.xml. In a J2EE web application, Log4J is usually set up via Log4jConfigListener or Log4jConfigServlet, delegating to Log4jWebConfigurer underneath.
author:
   Juergen Hoeller
since:
   13.03.2003
See Also:   org.springframework.web.util.Log4jWebConfigurer
See Also:   org.springframework.web.util.Log4jConfigListener
See Also:   org.springframework.web.util.Log4jConfigServlet



Field Summary
final public static  StringCLASSPATH_URL_PREFIX
    
final public static  StringXML_FILE_EXTENSION
    


Method Summary
public static  voidinitLogging(String location)
     Initialize Log4J from the given file location, with no config file refreshing. Assumes an XML file in case of a ".xml" file extension, and a properties file else.
Parameters:
  location - the location of the config file: either a "classpath:" location(e.g.
public static  voidinitLogging(String location, long refreshInterval)
     Initialize Log4J from the given location, with the given refresh interval for the config file.
public static  voidsetWorkingDirSystemProperty(String key)
     Set the specified system property to the current working directory.

This can be used e.g.

public static  voidshutdownLogging()
     Shut down Log4J, properly releasing all file locks.

Field Detail
CLASSPATH_URL_PREFIX
final public static String CLASSPATH_URL_PREFIX(Code)
Pseudo URL prefix for loading from the class path: "classpath:"



XML_FILE_EXTENSION
final public static String XML_FILE_EXTENSION(Code)
Extension that indicates a Log4J XML config file: ".xml"





Method Detail
initLogging
public static void initLogging(String location) throws FileNotFoundException(Code)
Initialize Log4J from the given file location, with no config file refreshing. Assumes an XML file in case of a ".xml" file extension, and a properties file else.
Parameters:
  location - the location of the config file: either a "classpath:" location(e.g. "classpath:myLog4j.properties"), an absolute file URL(e.g. "file:C:/log4j.properties), or a plain absolute path in the file system(e.g. "C:/log4j.properties")
throws:
  FileNotFoundException - if the location specifies an invalid file path



initLogging
public static void initLogging(String location, long refreshInterval) throws FileNotFoundException(Code)
Initialize Log4J from the given location, with the given refresh interval for the config file. Assumes an XML file in case of a ".xml" file extension, and a properties file else.

Log4J's watchdog thread will asynchronously check whether the timestamp of the config file has changed, using the given interval between checks. A refresh interval of 1000 milliseconds (one second), which allows to do on-demand log level changes with immediate effect, is not unfeasible.

WARNING: Log4J's watchdog thread does not terminate until VM shutdown; in particular, it does not terminate on LogManager shutdown. Therefore, it is recommended to not use config file refreshing in a production J2EE environment; the watchdog thread would not stop on application shutdown there.
Parameters:
  location - the location of the config file: either a "classpath:" location(e.g. "classpath:myLog4j.properties"), an absolute file URL(e.g. "file:C:/log4j.properties), or a plain absolute path in the file system(e.g. "C:/log4j.properties")
Parameters:
  refreshInterval - interval between config file refresh checks, in milliseconds
throws:
  FileNotFoundException - if the location specifies an invalid file path




setWorkingDirSystemProperty
public static void setWorkingDirSystemProperty(String key)(Code)
Set the specified system property to the current working directory.

This can be used e.g. for test environments, for applications that leverage Log4jWebConfigurer's "webAppRootKey" support in a web environment.
Parameters:
  key - system property key to use, as expected in Log4j configuration(for example: "demo.root", used as "${demo.root}/WEB-INF/demo.log")
See Also:   org.springframework.web.util.Log4jWebConfigurer




shutdownLogging
public static void shutdownLogging()(Code)
Shut down Log4J, properly releasing all file locks.

This isn't strictly necessary, but recommended for shutting down Log4J in a scenario where the host VM stays alive (for example, when shutting down an application in a J2EE environment).




Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.