summaryrefslogtreecommitdiffstats
path: root/src/com/gitblit/GitBlitServer.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/gitblit/GitBlitServer.java')
-rw-r--r--src/com/gitblit/GitBlitServer.java20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/com/gitblit/GitBlitServer.java b/src/com/gitblit/GitBlitServer.java
index a82b595f..9a9f63e2 100644
--- a/src/com/gitblit/GitBlitServer.java
+++ b/src/com/gitblit/GitBlitServer.java
@@ -110,7 +110,23 @@ public class GitBlitServer {
* Start Server.
*/
private static void start(Params params) {
- PatternLayout layout = new PatternLayout(fileSettings.getString(Keys.server.log4jPattern, "%-5p %d{MM-dd HH:mm:ss.SSS} %-20.20c{1} %m%n"));
+ String pattern = fileSettings.getString(Keys.server.log4jPattern, "%-5p %d{MM-dd HH:mm:ss.SSS} %-20.20c{1} %m%n");
+
+ // allow os override of logging pattern
+ String os = System.getProperty("os.name").toLowerCase();
+ if (os.indexOf("windows") > -1) {
+ String winPattern = fileSettings.getString(Keys.server.log4jPattern_windows, pattern);
+ if (!StringUtils.isEmpty(winPattern)) {
+ pattern = winPattern;
+ }
+ } else if (os.indexOf("linux") > -1) {
+ String linuxPattern = fileSettings.getString(Keys.server.log4jPattern_linux, pattern);
+ if (!StringUtils.isEmpty(linuxPattern)) {
+ pattern = linuxPattern;
+ }
+ }
+
+ PatternLayout layout = new PatternLayout(pattern);
org.apache.log4j.Logger rootLogger = org.apache.log4j.Logger.getRootLogger();
rootLogger.addAppender(new ConsoleAppender(layout));
@@ -244,7 +260,7 @@ public class GitBlitServer {
// Setup the GitBlit context
GitBlit gitblit = GitBlit.self();
- gitblit.setupContext(fileSettings);
+ gitblit.configureContext(fileSettings);
rootContext.addEventListener(gitblit);
// Start the Server