Repository: olingo-odata4 Updated Branches: refs/heads/master bf4e34d87 -> 9ef6863ca
[OLINGO-377] Enabled log to file 'fit.log' Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/9ef6863c Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/9ef6863c Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/9ef6863c Branch: refs/heads/master Commit: 9ef6863caaa60529090fd234613135d0e817270d Parents: bf4e34d Author: Michael Bolz <[email protected]> Authored: Fri Aug 1 08:55:24 2014 +0200 Committer: Michael Bolz <[email protected]> Committed: Fri Aug 1 09:07:16 2014 +0200 ---------------------------------------------------------------------- fit/pom.xml | 11 ++++------ .../olingo/fit/server/TomcatTestServer.java | 17 +++++++++++++++ fit/src/main/resources/log4j.properties | 23 ++++++++++++++++++++ fit/src/main/resources/simplelogger.properties | 19 ---------------- pom.xml | 12 +++++++++- 5 files changed, 55 insertions(+), 27 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9ef6863c/fit/pom.xml ---------------------------------------------------------------------- diff --git a/fit/pom.xml b/fit/pom.xml index 52b8550..403a203 100644 --- a/fit/pom.xml +++ b/fit/pom.xml @@ -84,12 +84,11 @@ </dependency> <dependency> <groupId>org.apache.tomcat.embed</groupId> - <artifactId>tomcat-embed-logging-juli</artifactId> + <artifactId>tomcat-embed-logging-log4j</artifactId> </dependency> <dependency> <groupId>org.apache.tomcat</groupId> <artifactId>tomcat-jasper</artifactId> - <version>${tomcat.version}</version> </dependency> <dependency> @@ -104,14 +103,12 @@ </dependency> <dependency> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - <scope>provided</scope> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-log4j12</artifactId> </dependency> <dependency> <groupId>org.slf4j</groupId> - <artifactId>slf4j-simple</artifactId> - <scope>compile</scope> + <artifactId>slf4j-api</artifactId> </dependency> <dependency> http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9ef6863c/fit/src/main/java/org/apache/olingo/fit/server/TomcatTestServer.java ---------------------------------------------------------------------- diff --git a/fit/src/main/java/org/apache/olingo/fit/server/TomcatTestServer.java b/fit/src/main/java/org/apache/olingo/fit/server/TomcatTestServer.java index 4d7924b..6a050c6 100644 --- a/fit/src/main/java/org/apache/olingo/fit/server/TomcatTestServer.java +++ b/fit/src/main/java/org/apache/olingo/fit/server/TomcatTestServer.java @@ -42,6 +42,10 @@ import java.util.Properties; import java.util.UUID; import java.util.jar.JarEntry; import java.util.jar.JarFile; +import java.util.logging.FileHandler; +import java.util.logging.Handler; +import java.util.logging.Level; +import java.util.logging.SimpleFormatter; /** * @@ -53,6 +57,19 @@ public class TomcatTestServer { private TomcatTestServer(Tomcat tomcat) { this.tomcat = tomcat; + enableLogging(); + } + + private void enableLogging() { + java.util.logging.Logger logger = java.util.logging.Logger.getLogger(""); + try { + Handler fileHandler = new FileHandler(tomcat.getHost().getAppBase() + "/catalina.out", true); + fileHandler.setFormatter(new SimpleFormatter()); + fileHandler.setLevel(Level.ALL); + logger.addHandler(fileHandler); + } catch (IOException e) { + throw new RuntimeException("Unable to configure embedded tomcat logging."); + } } public static void main(String[] params) { http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9ef6863c/fit/src/main/resources/log4j.properties ---------------------------------------------------------------------- diff --git a/fit/src/main/resources/log4j.properties b/fit/src/main/resources/log4j.properties new file mode 100644 index 0000000..0b0bb4d --- /dev/null +++ b/fit/src/main/resources/log4j.properties @@ -0,0 +1,23 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +log4j.rootLogger=DEBUG, FILE +log4j.appender.FILE=org.apache.log4j.RollingFileAppender +log4j.appender.FILE.File=${project.build.directory}/emb-tom-fit/fit.log +log4j.appender.FILE.layout=org.apache.log4j.PatternLayout +log4j.appender.FILE.layout.ConversionPattern=[%-5p] %r %c - %m%n http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9ef6863c/fit/src/main/resources/simplelogger.properties ---------------------------------------------------------------------- diff --git a/fit/src/main/resources/simplelogger.properties b/fit/src/main/resources/simplelogger.properties deleted file mode 100644 index fcde843..0000000 --- a/fit/src/main/resources/simplelogger.properties +++ /dev/null @@ -1,19 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -org.slf4j.simpleLogger.defaultLogLevel=debug http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9ef6863c/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 222dca5..4967edb 100644 --- a/pom.xml +++ b/pom.xml @@ -230,9 +230,19 @@ </dependency> <dependency> <groupId>org.apache.tomcat.embed</groupId> - <artifactId>tomcat-embed-logging-juli</artifactId> + <artifactId>tomcat-embed-logging-log4j</artifactId> <version>${tomcat.version}</version> </dependency> + <dependency> + <groupId>org.apache.tomcat</groupId> + <artifactId>tomcat-jasper</artifactId> + <version>${tomcat.version}</version> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-log4j12</artifactId> + <version>${sl4j.version}</version> + </dependency> <!-- Pojogen Maven Plugin depenencies --> <dependency>
