Adding JMCR-Stable version
[Benchmarks_CSolver.git] / JMCR-Stable / real-world application / weblech / src / weblech / util / Log4j.java
diff --git a/JMCR-Stable/real-world application/weblech/src/weblech/util/Log4j.java b/JMCR-Stable/real-world application/weblech/src/weblech/util/Log4j.java
new file mode 100644 (file)
index 0000000..8ea63a7
--- /dev/null
@@ -0,0 +1,60 @@
+/*\r
+ * This is the MIT license, see also http://www.opensource.org/licenses/mit-license.html\r
+ *\r
+ * Copyright (c) 2001 Brian Pitcher\r
+ *\r
+ * Permission is hereby granted, free of charge, to any person obtaining a\r
+ * copy of this software and associated documentation files (the "Software"),\r
+ * to deal in the Software without restriction, including without limitation\r
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,\r
+ * and/or sell copies of the Software, and to permit persons to whom the\r
+ * Software is furnished to do so, subject to the following conditions:\r
+ *\r
+ * The above copyright notice and this permission notice shall be included in\r
+ * all copies or substantial portions of the Software.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ */\r
+\r
+// $Header: /project/jiss/smhuang/leap/weblech/src/weblech/util/Log4j.java,v 1.1 2010/06/30 15:45:28 smhuang Exp $\r
+\r
+package weblech.util;\r
+\r
+import org.apache.log4j.*;\r
+\r
+import java.io.IOException;\r
+\r
+public class Log4j\r
+{\r
+    private static Category _logClass = Category.getInstance(Log4j.class);\r
+\r
+    static\r
+    {\r
+        Layout l = new PatternLayout("%d [%t] %-5p %F:%L - %m\n");\r
+        ConsoleAppender capp = new ConsoleAppender(l);\r
+        capp.setThreshold(Priority.INFO);\r
+        BasicConfigurator.configure(capp);\r
+        try\r
+        {\r
+            FileAppender fapp = new FileAppender(l, "weblech.log", false);\r
+            BasicConfigurator.configure(fapp);\r
+            System.err.println("Log4j configured to use weblech.log -- view full logging here");\r
+        }\r
+        catch(IOException ioe)\r
+        {\r
+            _logClass.warn("IO Exception when configuring log4j: " + ioe.getMessage(), ioe);\r
+        }\r
+        _logClass.debug("Log4j configured");\r
+    }\r
+\r
+    public static void init()\r
+    {\r
+\r
+    }\r
+}\r