Bug 158350 - [patch] www/tomcat7: add optional cronolog processing
Summary: [patch] www/tomcat7: 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:40 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 :)
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2011-06-27 17:30:32 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:37:31 UTC
send-pr didn't attach patch

Index: tomcat7/Makefile
===================================================================
RCS file: /home/jhelfman/ncvs/ports/www/tomcat7/Makefile,v
retrieving revision 1.68
diff -u -r1.68 Makefile
--- tomcat7/Makefile	21 Jun 2011 09:53:15 -0000	1.68
+++ tomcat7/Makefile	27 Jun 2011 02:56:34 -0000
@@ -7,6 +7,7 @@
  
  PORTNAME=	tomcat
  PORTVERSION=	7.0.16
+PORTREVISION=	1
  CATEGORIES=	www java
  MASTER_SITES=	${MASTER_SITE_APACHE}
  MASTER_SITE_SUBDIR=	tomcat/tomcat-7/v${PORTVERSION}/bin
@@ -15,6 +16,9 @@
  MAINTAINER=	ale@FreeBSD.org
  COMMENT=	Open-source Java web server by Apache, 7.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
  
@@ -34,11 +38,30 @@
  		WWWOWN=${WWWOWN} WWWGRP=${WWWGRP}
  LATEST_LINK=	${APP_SHORTNAME}
  
-SUB_LIST=	TOMCAT_HOME=${TOMCAT_HOME} \
+SUB_LIST=	LOG_ARGS=${LOG_ARGS} \
+		TOMCAT_HOME=${TOMCAT_HOME} \
  		TOMCAT_USER=${WWWOWN}
  
  .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?=">> \$${tomcat7_stdout_log} 2>> \$${tomcat7_stderr_log}"
+.else
+LOG_ARGS?="2>\&1 | ${LOCALBASE}/sbin/cronolog --link \$${tomcat7_catalina_base}/logs/catalina.out \$${tomcat7_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:    ${TOMCAT_HOME}"
Index: tomcat7/files/tomcat7.in
===================================================================
RCS file: /home/jhelfman/ncvs/ports/www/tomcat7/files/tomcat7.in,v
retrieving revision 1.2
diff -u -r1.2 tomcat7.in
--- tomcat7/files/tomcat7.in	26 Oct 2010 08:20:15 -0000	1.2
+++ tomcat7/files/tomcat7.in	26 Jun 2011 01:14:39 -0000
@@ -99,8 +99,7 @@
  	-Djava.io.tmpdir=${tomcat7_catalina_tmpdir} \
  	${java_class}"
  
-log_args=">> ${tomcat7_stdout_log} \
-	2>> ${tomcat7_stderr_log} "
+log_args="%%LOG_ARGS%%"
  
  required_files="${tomcat7_catalina_base}/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 freebsd_triage 2011-06-28 14:30:02 UTC
State Changed
From-To: open->closed

Use newsyslog.
Comment 4 Jason 2011-06-29 22:43:43 UTC
On Tue, Jun 28, 2011 at 01:31:05PM +0000, ale@FreeBSD.org thus spake:
>Synopsis: [patch] www/tomcat7: add optional cronolog processing
>
>State-Changed-From-To: open->closed
>State-Changed-By: ale
>State-Changed-When: Tue Jun 28 13:30:02 UTC 2011
>State-Changed-Why:
>Use newsyslog.
>

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.

Please reconsider using this patch.
Thanks!

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

  FreeBSD ports repository

  Modified files:
    www/tomcat7          Makefile 
    www/tomcat7/files    tomcat7.in 
  Log:
  Add the ability to specify a different logger.
  The tomcat7_stdout/stderr_log parameters have been
  replaced by tomcat7_catalina_log
  Use catalina.out as default log file and bump PORTREVISION.
  
  PR:             ports/158350
  Submitted by:   Jason Helfman <jhelfman@experts-exchange.com>
  
  Revision  Changes    Path
  1.69      +1 -0      ports/www/tomcat7/Makefile
  1.3       +6 -14     ports/www/tomcat7/files/tomcat7.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"