ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Gainty <mgai...@hotmail.com>
Subject RE: I want to send (explicit) quiet output to the screen and (automatic) verbose output to a log file
Date Fri, 20 Feb 2009 14:26:25 GMT

commons-logging is what you're looking for ..doc is available at 
http://commons.apache.org/logging/
Download it and read the doc on how to deploy at

http://commons.apache.org/logging/commons-logging-1.1.1/guide.html#Creating%20a%20Log%20Implementation

edit the simplelogging.properties configuration file contains configuration options 
org.apache.commons.logging.impl.SimpleLog class specifically you need to set these options
org.apache.commons.logging.simplelog.defaultlog -
      Default logging detail level for all instances of SimpleLog.
      Must be one of:
      tracedebuginfowarnerrorfatal
      If not specified, defaults to info. org.apache.commons.logging.simplelog.log.xxxxx -
      Logging detail level for a SimpleLog instance named "xxxxx".
      Must be one of:
      tracedebuginfowarnerrorfatal
      If not specified, the default logging detail level is used.org.apache.commons.logging.simplelog.showlogname
-
      Set to true if you want the Log instance name to be
      included in output messages. Defaults to false.org.apache.commons.logging.simplelog.showShortLogname
-
      Set to true if you want the last component of the name to be
      included in output messages. Defaults to true.org.apache.commons.logging.simplelog.showdatetime
-
      Set to true if you want the current date and time
      to be included in output messages. Default is false.org.apache.commons.logging.simplelog.dateTimeFormat
-
      The date and time format to be used in the output messages.
      The pattern describing the date and time format is the same that is
      used in java.text.SimpleDateFormat. If the format is not
      specified or is invalid, the default format is used.
      The default format is yyyy/MM/dd HH:mm:ss:SSS zzz.
Place simplelogging.properties configuration in same location as commons-logging.jar
(usually in WEB-INF/lib folder) and everything will work after reloading your webapp
if not unzip jar contents to WEB-INF/classes and place a copy of simplelogging.properties
there

Martin 
______________________________________________ 
Disclaimer and confidentiality note 
Everything in this e-mail and any attachments relates to the official business of Sender.
This transmission is of a confidential nature and Sender does not endorse distribution to
any party other than intended recipient. Sender does not necessarily endorse content contained
within this transmission. 




> Date: Fri, 20 Feb 2009 13:10:20 +0200
> Subject: I want to send (explicit) quiet output to the screen and (automatic) 	verbose
output to a log file
> From: dylan.farre@gmail.com
> To: user@ant.apache.org
> 
> Hi
> I am writing an installation program using Ant. Currently I am running my
> program in quiet mode. This way, I can send user information requests
> [input] to the screen as well as [echo] specific information that I want the
> user to see. I can also send other debugging and logging information to
> various log files.
> 
> This is all easy. I have written a couple of simple macros, which makes it
> even easier and gives me more control.
> 
> I want to know if there is an easy and automatic way to at the same time as
> the above, send the automatically generated verbose information to a log
> file, without sending it to the screen. For example a replace task generates
> some verbose information (and a summary), that I want sent to the log file,
> but not the screen.
> 
> I could manually echo some info to the log, e.g. the token and the value for
> example. I have to problems with this:
> 1) It is manual, not automatic
> 2) I don't have access to that internal verbose information, for example the
> replace summary. [replace] Replaced 6 occurrences in 0 files.
> 
> I know that you can override the logger. I have looked for a logger that
> does what I want, but not found anything yet. Can anyone recommend one and
> some tips or examples of how to get it to do what I want it too? It seems
> like Log4J could be setup to do this, but it looks a bit complicated.
> 
> I am also already using AntXtras for things like variables and looping
> tasks. If you are not using AntXtras, yet, I highly recommend this, it fills
> a lot of the gaps in Ant and is really easy to use. I see AntXtras has some
> special support for Log4J, but I have not looked into this yet. Perhaps
> someone can give me some pointers on how to use AntXtras to do the type of
> logging that I need.
> 
> I don't have any Java experience, so I am not in a position to be able to do
> my own implementation.
> 
> I would even settle for a script internal task to manually switch between
> verbose logging to file and quiet logging to the screen, as and when I want
> to switch.
> 
> Any help will be much appreciated.
> Best Regards
> Dylan

_________________________________________________________________
Windows Liveā„¢: E-mail. Chat. Share. Get more ways to connect. 
http://windowslive.com/online/hotmail?ocid=TXT_TAGLM_WL_HM_AE_Faster_022009
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message