Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Running as a service and Log4j configuration
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  18 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Drew  
View profile  
 More options Feb 1 2012, 8:35 pm
From: Drew <d...@venarc.com>
Date: Wed, 1 Feb 2012 17:35:32 -0800 (PST)
Local: Wed, Feb 1 2012 8:35 pm
Subject: Running as a service and Log4j configuration
Hi,

First and foremost, great job on building such a nice git web ui. I'm
migrating our repos from gitorious to gitblit now!

I'm trying to run gitblit as a service under Ubuntu server but I can't
seem to be able to configure log4j to log to a file instead of the
console. I tried passing -Dlog4j.configuration=custom_log4j.properties
but that didn't work. Seems like log4j configuration is read from temp/
webapp/log4j.properties and gets overwritten every time the server
start.

In addition, the current gitlab init.d script runs as root, I'm not
that good with bash, but I think it would be better if there was a way
to specify it to run with a less privileged user.

Thanks,

Drew


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
James Moger  
View profile  
 More options Feb 2 2012, 7:41 am
From: James Moger <james.mo...@gmail.com>
Date: Thu, 2 Feb 2012 07:41:14 -0500
Local: Thurs, Feb 2 2012 7:41 am
Subject: Re: Running as a service and Log4j configuration
Gitblit GO does not allow modifying the log4j configuration.

Having said that GO does create log files.  They should be located in
a "logs" folder wherever you unpacked the GO zip file.

> In addition, the current gitlab init.d script runs as root, I'm not
> that good with bash, but I think it would be better if there was a way
> to specify it to run with a less privileged user.

I can not speak for Gitlab, that is not my project.

-J


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
James Moger  
View profile  
 More options Feb 2 2012, 9:20 am
From: James Moger <james.mo...@gmail.com>
Date: Thu, 2 Feb 2012 09:20:34 -0500
Local: Thurs, Feb 2 2012 9:20 am
Subject: Re: Running as a service and Log4j configuration
Hmmm.  It seems that GO is not properly creating log files.  I'm going
to revise the service scripts for the next release as I can see there
are issues with them.

Below is a revised script that I am using on Ubuntu Server 11.04.  The
console output is redirected to a log file.  You don't get rotation,
etc, but it is a start.  Alternatively, you could install Tomcat and
use the WAR build.

#!/bin/sh

set -e

GITBLIT_PATH=/shares/gitblit/
GITBLIT_HTTP_PORT=0
GITBLIT_HTTPS_PORT=8443
JAVA="java -server -Xmx1024M -jar"

. /lib/lsb/init-functions

case "$1" in
  start)
        log_action_begin_msg "Starting gitblit server"
        cd $GITBLIT_PATH
        $JAVA $GITBLIT_PATH/gitblit.jar --httpsPort
$GITBLIT_HTTPS_PORT --httpPort $GITBLIT_HTTP_PORT >
/var/log/gitblit.log &
        log_action_end_msg $?
        ;;
  stop)
        log_action_begin_msg "Stopping gitblit server"
        cd $GITBLIT_PATH
        $JAVA $GITBLIT_PATH/gitblit.jar --stop &
        log_action_end_msg $?
        ;;
  force-reload|restart)
        $0 stop
        $0 start
        ;;
  *)
        echo "Usage: /etc/init.d/gitblit {start|stop|restart|force-reload}"
        exit 1
        ;;
esac

exit 0


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Drew Kutcharian  
View profile  
 More options Feb 2 2012, 11:47 am
From: Drew Kutcharian <d...@venarc.com>
Date: Thu, 2 Feb 2012 08:47:37 -0800
Local: Thurs, Feb 2 2012 11:47 am
Subject: Re: Running as a service and Log4j configuration
Hi James,

Sorry, that was a typo, I meant GitBlit not Gitlab.

- Drew

On Feb 2, 2012, at 4:41 AM, James Moger <james.mo...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Drew Kutcharian  
View profile  
 More options Feb 2 2012, 11:55 am
From: Drew Kutcharian <d...@venarc.com>
Date: Thu, 2 Feb 2012 08:55:43 -0800
Local: Thurs, Feb 2 2012 11:55 am
Subject: Re: Running as a service and Log4j configuration
I think you should move the log4j.properties out of the jar file so it's possible to modify it.

In addition, the init.d script that you have will run gitblit as root, no? usually you need to "su" to a less privileged user.

- Drew

On Feb 2, 2012, at 6:20 AM, James Moger <james.mo...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
James Moger  
View profile  
 More options Feb 2 2012, 12:05 pm
From: James Moger <james.mo...@gmail.com>
Date: Thu, 2 Feb 2012 12:05:32 -0500
Local: Thurs, Feb 2 2012 12:05 pm
Subject: Re: Running as a service and Log4j configuration
Yes, it probably does run as root.  I personally don't have a problem
with that.  Linux service scripts are a shortcoming in Gitblit.
Unfortunately, there is no one script that will work across all
flavors and as you point out you may want to run as a less privileged
user which may require doing a useradd and chgrp during
install-service.  If you come up with a more manageable solution
please open a pull request on GitHub and I'll merge it.

-J


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Drew Kutcharian  
View profile  
 More options Feb 2 2012, 12:34 pm
From: Drew Kutcharian <d...@venarc.com>
Date: Thu, 2 Feb 2012 09:34:25 -0800
Local: Thurs, Feb 2 2012 12:34 pm
Subject: Re: Running as a service and Log4j configuration
I'm going to work on integrating GitBlit with Tomcat with Apache front-end using AJP and running it using Java Service Wrapper as a standard unix daemon. This is more of a production setup. I will email you the instructions.

Thanks again for creating GitBlit. I'm really starting to like it.

-- Drew

On Feb 2, 2012, at 9:05 AM, James Moger wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
James Moger  
View profile  
 More options Feb 2 2012, 12:37 pm
From: James Moger <james.mo...@gmail.com>
Date: Thu, 2 Feb 2012 12:37:59 -0500
Local: Thurs, Feb 2 2012 12:37 pm
Subject: Re: Running as a service and Log4j configuration
You are going to run into url proxy issues.  Make sure to read the FAQ
about Tomcat and proxy layers.

-J


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Drew Kutcharian  
View profile  
 More options Feb 2 2012, 12:45 pm
From: Drew Kutcharian <d...@venarc.com>
Date: Thu, 2 Feb 2012 09:45:00 -0800
Subject: Re: Running as a service and Log4j configuration
I'm actually currently running GitBlit behind Apache using mod_proxy_http and I had the slash encoding issue so I disabled web.mountParameters since my apache doesn't support AllowEncodedSlashes NoDecode. I'm hoping I can get the pretty URLs to work using Tomcat/AJP.

I still prefer using GitBlit GO if I can get the custom logging and AJP connector.

-- Drew

On Feb 2, 2012, at 9:37 AM, James Moger wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Drew Kutcharian  
View profile  
 More options Feb 2 2012, 12:48 pm
From: Drew Kutcharian <d...@venarc.com>
Date: Thu, 2 Feb 2012 09:48:58 -0800
Local: Thurs, Feb 2 2012 12:48 pm
Subject: Re: Running as a service and Log4j configuration
BTW, what version of Tomcat do you recommend for the WAR deploy?

On Feb 2, 2012, at 9:37 AM, James Moger wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
James Moger  
View profile  
 More options Feb 2 2012, 12:53 pm
From: James Moger <james.mo...@gmail.com>
Date: Thu, 2 Feb 2012 12:53:44 -0500
Local: Thurs, Feb 2 2012 12:53 pm
Subject: Re: Running as a service and Log4j configuration
Tomcat 6 or 7 should be fine.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Drew  
View profile  
 More options Feb 2 2012, 9:45 pm
From: Drew <d...@venarc.com>
Date: Thu, 2 Feb 2012 18:45:18 -0800 (PST)
Local: Thurs, Feb 2 2012 9:45 pm
Subject: Re: Running as a service and Log4j configuration
So I got it working with Tomcat 7, Apache AJP and Java Service
Wrapper. It was pretty straight forward.

On Feb 2, 9:53 am, James Moger <james.mo...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
James Moger  
View profile  
 More options Feb 3 2012, 7:34 am
From: James Moger <james.mo...@gmail.com>
Date: Fri, 3 Feb 2012 07:34:42 -0500
Local: Fri, Feb 3 2012 7:34 am
Subject: Re: Running as a service and Log4j configuration
Nice.  If you write it up I can include it in the next release of the site/docs.

-J


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Drew Kutcharian  
View profile  
 More options Feb 3 2012, 12:56 pm
From: Drew Kutcharian <d...@venarc.com>
Date: Fri, 3 Feb 2012 09:56:52 -0800
Local: Fri, Feb 3 2012 12:56 pm
Subject: Re: Running as a service and Log4j configuration
Sure, I'll write it up and will email it to you.

On Feb 3, 2012, at 4:34 AM, James Moger wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kosta  
View profile  
 More options Feb 6 2012, 9:02 am
From: Kosta <kosta.gra...@gmail.com>
Date: Mon, 6 Feb 2012 06:02:21 -0800 (PST)
Local: Mon, Feb 6 2012 9:02 am
Subject: Re: Running as a service and Log4j configuration
I'd like to see an ajp-connector in the standalone (GO) version.
Any plans on adding ajp ?
Couldn't spot it on the Roadmap.

Note: For sure it would be possible to use the war-version and tomcat
to get ajp working, but as I use tomcat for ci-deployments its a
rather bad
idea to deploy gitblit to it. A separate tomcat-instance seems like an
overkill.
I guess there are many people that would like to use ajp with there
own reasons.

On 3 Feb., 18:56, Drew Kutcharian <d...@venarc.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
James Moger  
View profile  
 More options Feb 6 2012, 9:24 am
From: James Moger <james.mo...@gmail.com>
Date: Mon, 6 Feb 2012 09:24:48 -0500
Local: Mon, Feb 6 2012 9:24 am
Subject: Re: Running as a service and Log4j configuration

> I'd like to see an ajp-connector in the standalone (GO) version.
> Any plans on adding ajp ?

Open an issue for this and I'll see what I can do.

-J


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
James Moger  
View profile  
 More options Feb 9 2012, 7:46 pm
From: James Moger <james.mo...@gmail.com>
Date: Thu, 9 Feb 2012 16:46:25 -0800 (PST)
Local: Thurs, Feb 9 2012 7:46 pm
Subject: Re: Running as a service and Log4j configuration

Drew,

I looked into moving log4j.properties and I remember now why it is in
inside the jar.  When this file is on the classpath it is automatically
loaded by log4j both in deployment and in an IDE.  Otherwise you have to
specify its location manually.  I can still do this but for the time being
I won't because it complicates things when there are alternatives.

The -D parameter you tried specifying does work, but you have to specify it
as a URL:

-Dlog4j.configuration=file:///home/james/log4j.properties

or in a full example:

java -Dlog4j.configuration=file:///home/james/log4j.properties -jar
gitblit.jar <optional_gitblit_args>

I'll improve the documentation on this for the next release.

The following is Gitblit's log4j configuration.  I forgot that I had
disabled the file appenders - they are defined just not activated.

#-------------------------------------------------------------------------- ----
#
#  The following properties set the logging levels and log appender.  The
#  log4j.rootCategory variable defines the default log level and one or more
#  appenders.  For the console, use 'S'.  For the daily rolling file, use
'R'.
#  For an HTML formatted log, use 'H'.
#
#  To override the default (rootCategory) log level, define a property of
the
#  form (see below for available values):
#
#        log4j.logger. =
#
#    Available logger names:
#      TODO
#
#    Possible Log Levels:
#      FATAL, ERROR, WARN, INFO, DEBUG
#
#-------------------------------------------------------------------------- ----
log4j.rootCategory=INFO, S

#log4j.rootLogger=INFO
#log4j.logger.org=INFO
#log4j.logger.com=INFO
#log4j.logger.net=INFO

#log4j.logger.com.gitblit=DEBUG

log4j.logger.org.apache.wicket=INFO
log4j.logger.org.apache.wicket.RequestListenerInterface=WARN
log4j.logger.org.apache.wicket.protocol.http.HttpSessionStore=WARN

#-------------------------------------------------------------------------- ----
#
#  The following properties configure the console (stdout) appender.
#  See http://logging.apache.org/log4j/docs/api/index.html for details.
#
#-------------------------------------------------------------------------- ----
log4j.appender.S = org.apache.log4j.ConsoleAppender
log4j.appender.S.layout = org.apache.log4j.PatternLayout
log4j.appender.S.layout.ConversionPattern = %-5p %m%n

#-------------------------------------------------------------------------- ----
#
#  The following properties configure the Daily Rolling File appender.
#  See http://logging.apache.org/log4j/docs/api/index.html for details.
#
#-------------------------------------------------------------------------- ----
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.layout = org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern = %d{yyyy-MM-dd HH:mm:ss} %c{1}
[%p] %m%n

#-------------------------------------------------------------------------- ----
#
#  The following properties configure the Rolling File appender in HTML.
#  See http://logging.apache.org/log4j/docs/api/index.html for details.
#
#-------------------------------------------------------------------------- ----
log4j.appender.H = org.apache.log4j.RollingFileAppender
log4j.appender.H.File = logs/gitblit.html
log4j.appender.H.MaxFileSize = 100KB
log4j.appender.H.Append = false
log4j.appender.H.layout = org.apache.log4j.HTMLLayout


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Drew Kutcharian  
View profile  
 More options Feb 10 2012, 9:10 pm
From: Drew Kutcharian <d...@venarc.com>
Date: Fri, 10 Feb 2012 18:10:49 -0800
Local: Fri, Feb 10 2012 9:10 pm
Subject: Re: Running as a service and Log4j configuration
Thanks James. I ended up using Tomcat and was able to configure the logging using log4j. But I think it's a great idea to update the docs since most users will be using the standalone version.

-- Drew

On Feb 9, 2012, at 4:46 PM, James Moger wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »