- Added raw links to the commit, commitdiff, and compare pages (issue-319)
- Support intradocument linking in Markdown content using [[WikiLinks]] syntax (issue-324)
- Support Markdown image links relative to the repository root (issue-324)
- - Added filesystem write permission check (issue-345)
+ - Added filesystem write permission check (issue-345)
+ - Added GO launch parameter for redirecting logging to a rolling, daily log file (issue-348)
- Support rendering confluence, mediawiki, textile, tracwiki, and twiki markup documents
- Added setting to globally disable anonymous pushes in the receive pack
- Added a normalized diffstat display to the commit, commitdiff, and compare pages
import java.io.File;\r
import java.io.FileWriter;\r
import java.io.IOException;\r
+import java.io.InputStream;\r
import java.io.InputStreamReader;\r
import java.io.OutputStream;\r
import java.net.InetAddress;\r
import java.util.ArrayList;\r
import java.util.Date;\r
import java.util.List;\r
+import java.util.Properties;\r
import java.util.Scanner;\r
\r
+import org.apache.log4j.PropertyConfigurator;\r
import org.eclipse.jetty.ajp.Ajp13SocketConnector;\r
import org.eclipse.jetty.security.ConstraintMapping;\r
import org.eclipse.jetty.security.ConstraintSecurityHandler;\r
settings = new FileSettings(params.settingsfile);\r
}\r
}\r
+\r
+ if (params.dailyLogFile) {\r
+ // Configure log4j for daily log file generation\r
+ InputStream is = null;\r
+ try {\r
+ is = getClass().getResourceAsStream("/log4j.properties");\r
+ Properties loggingProperties = new Properties();\r
+ loggingProperties.load(is);\r
+\r
+ loggingProperties.put("log4j.appender.R.File", new File(baseFolder, "logs/gitblit.log").getAbsolutePath());\r
+ loggingProperties.put("log4j.rootCategory", "INFO, R");\r
+\r
+ if (settings.getBoolean(Keys.web.debugMode, false)) {\r
+ loggingProperties.put("log4j.logger.com.gitblit", "DEBUG");\r
+ }\r
+\r
+ PropertyConfigurator.configure(loggingProperties);\r
+ } catch (Exception e) {\r
+ e.printStackTrace();\r
+ } finally {\r
+ try {\r
+ is.close();\r
+ } catch (IOException e) {\r
+ e.printStackTrace();\r
+ }\r
+ }\r
+ }\r
+\r
logger = LoggerFactory.getLogger(GitBlitServer.class);\r
logger.info(Constants.BORDER);\r
logger.info(" _____ _ _ _ _ _ _");\r
@Parameter(names = { "--tempFolder" }, description = "Folder for server to extract built-in webapp")\r
public String temp = FILESETTINGS.getString(Keys.server.tempFolder, "temp");\r
\r
+ @Parameter(names = { "--dailyLogFile" }, description = "Log to a rolling daily log file INSTEAD of stdout.")\r
+ public Boolean dailyLogFile = false;\r
+\r
/*\r
* GIT Servlet Parameters\r
*/\r
log4j.appender.R = org.apache.log4j.DailyRollingFileAppender
log4j.appender.R.File = logs/gitblit.log
log4j.appender.R.Append = true
-log4j.appender.R.DatePattern = '.'yyy-MM-dd
+log4j.appender.R.DatePattern = '.'yyyy-MM-dd
log4j.appender.R.layout = org.apache.log4j.PatternLayout
-log4j.appender.R.layout.ConversionPattern = %d{yyyy-MM-dd HH:mm:ss} %c-30{1} [%-5p] %m%n
+log4j.appender.R.layout.ConversionPattern = %d{yyyy-MM-dd HH:mm:ss} [%-5p] %m%n
#------------------------------------------------------------------------------
#
--alias Alias in keystore of SSL cert to use for https serving\r
--storePassword Password for SSL (https) keystore.\r
--shutdownPort Port for Shutdown Monitor to listen on. (port <= 0 will disable this monitor)\r
+ --dailyLogFile Redirect logging to a rolling, daily log file instead of stdout\r
--tempFolder Folder for server to extract built-in webapp\r
\r
**Example**\r
You can override Gitblit GO's default Log4j configuration with a command-line parameter to the JVM.\r
\r
java -Dlog4j.configuration=file:///home/james/log4j.properties -jar gitblit.jar <optional_gitblit_args>\r
- \r
-For reference, here is [Gitblit's default Log4j configuration](https://github.com/gitblit/gitblit/blob/master/src/log4j.properties). It includes some file appenders that are disabled by default. \r
+\r
+You can not use override the default log4j configuration *AND* specify the `--dailyLogFile` parameter. For reference, here is [Gitblit's default Log4j configuration](https://github.com/gitblit/gitblit/blob/master/src/log4j.properties). It includes some file appenders that are disabled by default. \r
\r