Bug 158349 - [patch] www/tomcat6: add optional cronolog processing
Summary: [patch] www/tomcat6: add optional cronolog processing
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Alex Dupre
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-27 17:30 UTC by Jason Helfman
Modified: 2011-07-06 14:30 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jason Helfman 2011-06-27 17:30:11 UTC
This adds cronolog as an optional processor for logging. Great feature for tomcat, that rotates log nightly :)
Builds cleanly in Tinderbox.
Comment 1 Edwin Groothuis freebsd_committer 2011-06-27 17:30:23 UTC
Responsible Changed
From-To: freebsd-ports-bugs->ale

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 Jason 2011-06-27 17:36:16 UTC
send-pr didn't attach patch

Index: tomcat6/Makefile
===================================================================
RCS file: /home/jhelfman/ncvs/ports/www/tomcat6/Makefile,v
retrieving revision 1.63
diff -u -r1.63 Makefile
--- tomcat6/Makefile	12 Jun 2011 13:55:39 -0000	1.63
+++ tomcat6/Makefile	27 Jun 2011 02:56:13 -0000
@@ -7,6 +7,7 @@
  
  PORTNAME=	tomcat
  PORTVERSION=	6.0.32
+PORTREVISION=	1
  CATEGORIES=	www java
  MASTER_SITES=	${MASTER_SITE_APACHE}
  MASTER_SITE_SUBDIR=	tomcat/tomcat-6/v${PORTVERSION}/bin
@@ -15,6 +16,9 @@
  MAINTAINER=	ale@FreeBSD.org
  COMMENT=	Open-source Java web server by Apache, 6.x branch
  
+OPTIONS=	CRONOLOG "Use Cronolog for Log Processing" Off \
+		CRONOLOG_DEVEL "Use Cronlog-Devel for Log Processing" Off
+
  LICENSE=	ASL
  LICENSE_FILE=	${WRKSRC}/LICENSE
  
@@ -50,6 +54,7 @@
  		GROUP=${TOMCAT_GROUP} \
  		HTTP_PORT=${HTTP_PORT} \
  		JAR_FILE=${JAR_FILE} \
+		LOG_ARGS=${LOG_ARGS} \
  		SHUTDOWN_PORT=${SHUTDOWN_PORT} \
  		STDERR_LOG=${STDERR_LOG} \
  		STDOUT_LOG=${STDOUT_LOG} \
@@ -59,6 +64,24 @@
  
  .include <bsd.port.pre.mk>
  
+.if defined(WITH_CRONOLOG)
+RUN_DEPENDS+=	cronolog:${PORTSDIR}/sysutils/cronolog
+.endif
+
+.if defined(WITH_CRONOLOG_DEVEL)
+RUN_DEPENDS+=	cronolog:${PORTSDIR}/sysutils/cronolog-devel
+.endif
+
+.if !( defined(WITH_CRONOLOG) || (WITH_CRONOLOG_DEVEL) )
+LOG_ARGS?=">> \$${tomcat\%\%TOMCAT_VERSION\%\%_stdout_log} 2>> \$${tomcat\%\%TOMCAT_VERSION\%\%_stderr_log}"
+.else
+LOG_ARGS?="2>\&1 | ${LOCALBASE}/sbin/cronolog --link \$${tomcat\%\%TOMCAT_VERSION\%\%_catalina_base}/logs/catalina.out \$${tomcat\%\%TOMCAT_VERSION\%\%_catalina_base}/logs/catalina.\%Y_\%m_\%d.out \&"
+.endif
+
+.if ( defined(WITH_CRONOLOG) && defined(WITH_CRONOLOG_DEVEL) )
+BROKEN=	You can only define one log pre-processor application.
+.endif
+
  pre-patch:
  	@${ECHO_MSG} "Installation settings:"
  	@${ECHO_MSG} "   Destination directory:    ${APP_HOME}"
Index: tomcat6/files/tomcat6.sh.in
===================================================================
RCS file: /home/jhelfman/ncvs/ports/www/tomcat6/files/tomcat6.sh.in,v
retrieving revision 1.9
diff -u -r1.9 tomcat6.sh.in
--- tomcat6/files/tomcat6.sh.in	26 Oct 2010 08:19:05 -0000	1.9
+++ tomcat6/files/tomcat6.sh.in	26 Jun 2011 00:51:02 -0000
@@ -103,8 +103,7 @@
  	-Djava.io.tmpdir=${tomcat%%TOMCAT_VERSION%%_catalina_tmpdir} \
  	${java_class}"
  
-log_args=">> ${tomcat%%TOMCAT_VERSION%%_stdout_log} \
-	2>> ${tomcat%%TOMCAT_VERSION%%_stderr_log} "
+log_args="%%LOG_ARGS%%"
  
  required_files="${tomcat%%TOMCAT_VERSION%%_catalina_home}/conf/server.xml"
  

-- 
Jason Helfman
System Administrator
experts-exchange.com
http://www.experts-exchange.com/M_4830110.html
E4AD 7CF1 1396 27F6 79DD  4342 5E92 AD66 8C8C FBA5
Comment 3 Alex Dupre freebsd_committer 2011-06-28 14:31:12 UTC
State Changed
From-To: open->closed

Use newsyslog.
Comment 4 Jason 2011-06-29 22:44:21 UTC
On Tue, Jun 28, 2011 at 01:31:24PM +0000, ale@FreeBSD.org thus spake:
>Synopsis: [patch] www/tomcat6: add optional cronolog processing
>
>State-Changed-From-To: open->closed
>State-Changed-By: ale
>State-Changed-When: Tue Jun 28 13:31:12 UTC 2011
>State-Changed-Why:
>Use newsyslog.
>
>http://www.freebsd.org/cgi/query-pr.cgi?pr=158349

I tried this as a test. I started tomcat w/o cronolog, and accessed the
service url. I then rotated the logs the way newsyslog would do. The
application didn't continue to log. We believe this is the case because
tomcat keeps the log file open while the process is running. If newsyslog
were to be used, the application would need to be restarted, which isn't 
always a great option from an administration point-of-view.

Using cronolog, allows the application to continue writing to the same file
without interrupting the application.

-- 
Jason Helfman/Phil Phillips
System Administrator
experts-exchange.com
Comment 5 dfilter service freebsd_committer 2011-07-06 14:29:24 UTC
ale         2011-07-06 13:29:09 UTC

  FreeBSD ports repository

  Modified files:
    www/tomcat6/files    tomcat6.sh.in 
  Log:
  Add the ability to specify a different logger.
  The tomcat60_stdout/stderr_log parameters have been
  replaced by tomcat60_catalina_log
  
  PR:             ports/158349
  Submitted by:   Jason Helfman <jhelfman@experts-exchange.com>
  
  Revision  Changes    Path
  1.10      +6 -14     ports/www/tomcat6/files/tomcat6.sh.in
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"