Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (309)
Collections:
Other Resources:
Sort.java with sort2.properties in log4j-1.2.17.zip
How to run the Sort.java example program with sort2.properties in log4j-1.2.17.zip? I have log4j-1.2.17.zip installed at \fyicenter\apache-log4j-1.2.17 folder.
✍: FYIcenter.com
sort2.properties file an example Log4j configuration file in properties format.
It can used to run the Sort.java example program provided in the log4j-1.2.17.zip.
Here is the content of sort2.properties located in the \fyicenter\apache-log4j-1.2.17\examples folder.
# Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # ... # An example log4j configuration file that outputs both to System.out # and a file named 'test'. # The root logger uses the appender called A1. # The root logger uses the appenders called A1 and A2. Since no level # is specified, note the empty string between the comma (",") and the # equals sign ("="), the level of the root logger remains # untouched. Log4j always initializes the level for the root logger to # DEBUG. The root logger is the only logger that has a default # level. Bu default, all other loggers do not have an assigned level, # such that they inherit their level instead. log4j.rootLogger=, A1, A2 # A1 is set to be ConsoleAppender sending its output to System.out log4j.appender.A1=org.apache.log4j.ConsoleAppender # A1 uses PatternLayout. log4j.appender.A1.layout=org.apache.log4j.PatternLayout # The conversion pattern consists of date in ISO8601 format, level, # thread name, logger name truncated to its rightmost two components # and left justified to 17 characters, location information consisting # of file name (padded to 13 characters) and line number, nested # diagnostic context, the and the application supplied message log4j.appender.A1.layout.ConversionPattern=%d %-5p [%t] %-17c{2} (%13F:%L) %3x - %m%n # Appender A2 writes to the file "test". log4j.appender.A2=org.apache.log4j.FileAppender log4j.appender.A2.File=test # Truncate 'test' if it aleady exists. log4j.appender.A2.Append=false # Appender A2 uses the PatternLayout. log4j.appender.A2.layout=org.apache.log4j.PatternLayout log4j.appender.A2.layout.ConversionPattern=%-5r %-5p [%t] %c{2} - %m%n
Let's run the Sort.java with this configuration file, sort2.properties:
\fyicenter>cd \fyicenter\apache-log4j-1.2.17 \fyicenter\apache-log4j-1.2.17>java -version java version "1.7.0_45" \fyicenter\apache-log4j-1.2.17>javac -cp .;log4j-1.2.17.jar examples\Sort.java \fyicenter\apache-log4j-1.2.17>java -cp .;log4j-1.2.17.jar examples.Sort examples\sort2.properties 10 10:07:09,344 INFO [main] examples.Sort ( Sort.java:69) - Populating an array of 10 elements in reverse order. 10:07:09,348 INFO [main] examples.SortAlgo (SortAlgo.java:48) - Entered the sort method. 10:07:09,348 DEBUG [main] SortAlgo.OUTER (SortAlgo.java:52) i=9 - in outer loop. 10:07:09,348 DEBUG [main] SortAlgo.INNER (SortAlgo.java:57) i=9 j=0 - in inner loop. 10:07:09,349 DEBUG [main] SortAlgo.SWAP (SortAlgo.java:80) i=9 j=0 - Swapping intArray[0]=9 and intArray[1]=8 ...
The sort2.properties configuration file also generated a log file called "test" to capture some different log messages:
\fyicenter\apache-log4j-1.2.17> type test 0 INFO [main] examples.Sort - Populating an array of 10 elements in reverse order. 4 INFO [main] examples.SortAlgo - Entered the sort method. 4 DEBUG [main] SortAlgo.OUTER - in outer loop. 4 DEBUG [main] SortAlgo.INNER - in inner loop. 5 DEBUG [main] SortAlgo.SWAP - Swapping intArray[0]=9 and intArray[1]=8 5 DEBUG [main] SortAlgo.INNER - in inner loop. ...
⇐ Run Sort.java Example in log4j-1.2.17.zip
2016-06-27, 2589🔥, 0💬
Popular Posts:
JDK 11 java.xml.crypto.jmod is the JMOD file for JDK 11 XML (eXtensible Markup Language) Crypto modu...
JDK 11 java.sql.rowset.jmod is the JMOD file for JDK 11 SQL Rowset module. JDK 11 SQL Rowset module ...
XStream is a simple library to serialize objects to XML and back again. JAR File Size and Download L...
JDK 11 jdk.rmic.jmod is the JMOD file for JDK 11 RMI (Remote Method Invocation) Compiler Tool tool, ...
HttpComponents Core Source Code Files are provided in the source package file, httpcomponents-core-5...