You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Navjot Singh <na...@net4india.net> on 2003/03/19 09:07:33 UTC

Re: jdk14 log

Hi Vic,

Properties File Attached. Remember, the logging takes the formatter
specified in props if called from command prompt.
When i called from servlet, it take XMLFormatter by default. However, if you
give BasicFormatter, it picks up SimpleFormatter.

It just refuses to pick my customer Formatter from Servlet.

Use this to read file
=============
   LogManager logman = LogManager.getLogManager();
   FileInputStream in = new FileInputStream(filename);
   logman.readConfiguration(in);

Use this to test the config set
====================

  LogManager manager = LogManager.getLogManager();
  // Get all defined loggers
  Enumeration names = manager.getLoggerNames();
  while (names.hasMoreElements())
  {
       String loggername = (String)names.nextElement();
       Logger logger = manager.getLogger(loggername);

       System.out.println("-----------------------");
       System.out.println("Logger name: >" + logger.getName() + "<");
       System.out.println("Logger level: " + logger.getLevel());

       Handler[] hs = logger.getHandlers();
       for(int i=0;i<hs.length;i++)
       {
            System.out.println("\t" + hs[i].toString() + "#" +
hs[i].getFormatter() + "->" + hs[i].getEncoding());
       }
  }

----- Original Message -----
From: "Vic Cekvenich" <vc...@basebeans.com>
To: "Navjot Singh" <na...@net4india.net>
Sent: Tuesday, March 18, 2003 10:46 PM
Subject: jdk14 log


| Can you send me the properties files and the command that read it?
| I am trying to get JDK1.4 log to work in struts.
| thanks
| .V
|
|
|


Re: jdk14 log

Posted by Navjot Singh <na...@net4india.net>.
ok, attachments are being stripped by mail server ;-)

=====================================
handlers = java.util.logging.FileHandler

.level= WARNING

java.util.logging.FileHandler.formatter =
com.myapp.util.logging.BasicFormatter
java.util.logging.FileHandler.pattern = /tmp/n4m-%u.%g.log
java.util.logging.FileHandler.count = 3
java.util.logging.FileHandler.limit = 500000
java.util.logging.FileHandler.append = false
java.util.logging.FileHandler.encoding = UTF-8
#java.util.logging.FileHandler.filter
#java.util.logging.FileHandler.level = INFO

############################################################
# Facility specific properties.
# Provides extra control for each logger.
############################################################

# For example, set the com.xyz.foo logger to only log SEVERE
# messages:
com.myapp.level = SEVERE
log.level = INFO
=====================================

----- Original Message -----
From: "Navjot Singh" <na...@net4india.net>
To: "Vic Cekvenich" <vc...@basebeans.com>
Cc: "Struts Users List" <st...@jakarta.apache.org>
Sent: Wednesday, March 19, 2003 1:37 PM
Subject: Re: jdk14 log


|
| Hi Vic,
|
| Properties File Attached. Remember, the logging takes the formatter
| specified in props if called from command prompt.
| When i called from servlet, it take XMLFormatter by default. However, if
you
| give BasicFormatter, it picks up SimpleFormatter.
|
| It just refuses to pick my customer Formatter from Servlet.
|
| Use this to read file
| =============
|    LogManager logman = LogManager.getLogManager();
|    FileInputStream in = new FileInputStream(filename);
|    logman.readConfiguration(in);
|
| Use this to test the config set
| ====================
|
|   LogManager manager = LogManager.getLogManager();
|   // Get all defined loggers
|   Enumeration names = manager.getLoggerNames();
|   while (names.hasMoreElements())
|   {
|        String loggername = (String)names.nextElement();
|        Logger logger = manager.getLogger(loggername);
|
|        System.out.println("-----------------------");
|        System.out.println("Logger name: >" + logger.getName() + "<");
|        System.out.println("Logger level: " + logger.getLevel());
|
|        Handler[] hs = logger.getHandlers();
|        for(int i=0;i<hs.length;i++)
|        {
|             System.out.println("\t" + hs[i].toString() + "#" +
| hs[i].getFormatter() + "->" + hs[i].getEncoding());
|        }
|   }
|
| ----- Original Message -----
| From: "Vic Cekvenich" <vc...@basebeans.com>
| To: "Navjot Singh" <na...@net4india.net>
| Sent: Tuesday, March 18, 2003 10:46 PM
| Subject: jdk14 log
|
|
| | Can you send me the properties files and the command that read it?
| | I am trying to get JDK1.4 log to work in struts.
| | thanks
| | .V
| |
| |
| |
|
|


----------------------------------------------------------------------------
----


| ---------------------------------------------------------------------
| To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
| For additional commands, e-mail: struts-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: jdk14 log

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Wed, 19 Mar 2003, Robert Taylor wrote:

> Date: Wed, 19 Mar 2003 10:10:36 -0500
> From: Robert Taylor <rt...@mulework.com>
> Reply-To: Struts Users Mailing List <st...@jakarta.apache.org>
> To: Struts Users Mailing List <st...@jakarta.apache.org>
> Subject: RE: jdk14 log
>
> Vic and Navjot, sorry I didn't respond sooner, I can't interact with
> the mailing list from work.
>
> I didn't really do anything special to get JDK1.4 logging to work
> with Struts. From what I understand, commons-logging will "detect"
> JDK1.4 logging, and use the logging.properties file for configuration.
> As I'm sure your aware, you can find the logging.properties file under
> jre/lib/.
>

More specifically, the default file is
"$JAVA_HOME/jre/lib/logging.properties", and the format of a local init
file is the same.

> For example, to kill all non-severe logging from struts and the validator,
> I put the following lines in the logging.properties file.
> org.apache.struts.level=SEVERE
> org.apache.commons.validator.level=SEVERE
>
> The servlet container we use takes standard out and writes it to a log file.
> So I just log using the SimpleFormatter and the ConsoleHandler.
>
> I don't use the LogManager at all. I use the logging package as is and it
> works fine.
>
> Maybe I'm doing something wrong that I'll run into later, but for now
> I'm happy with the configuration.
>
> I'm not sure I'm much help with this one.
>

Two things I ran into are useful warnings to others.

* Since this is my machine, I just go change the default
  logging properties when I want to modify them.  That
  file gets loaded only when the JVM uses them for the
  first time, so I have to restart Tomcat to get it to
  recognize changes.

* If you use the ConsoleHandler for output (so that the
  messages end up in catalina.out for Tomcat), there is
  a limit on the detail level of *any* message sent to
  the console, no matter what the individual level setting
  has.  Modify the following property to enable any sort
  of debugging message to be sent to the console handler:

  java.util.logging.ConsoleHandler.level = FINEST

> robert
>

Craig

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


how to define a bookmark with an Posted by Nicolas Robert <nr...@peopleware.lu>.
Hi,

Could you tell me how can I render this HTML code (specially the
#MyTargetLineName) :

<form name="myActionName" method="post"
action="/myaction.do#MyTargetLineName">

with an <html:form anchor ?

I've tryied with :

<%
	String actionName = "/myaction.do#MyTargetLineName";
%>

<html:form action="<%=actionName%>" >

But it render the following HTML code :

<form name="myActionName" method="post" action"/myaction.do">

and the "#MyTargetLineName" string disappeared (I need to have a
#MyTargetLineName rendered after the action)....

Thanks for you help,


Nicolas


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: jdk14 log

Posted by Robert Taylor <rt...@mulework.com>.
Vic and Navjot, sorry I didn't respond sooner, I can't interact with
the mailing list from work.

I didn't really do anything special to get JDK1.4 logging to work
with Struts. From what I understand, commons-logging will "detect"
JDK1.4 logging, and use the logging.properties file for configuration.
As I'm sure your aware, you can find the logging.properties file under
jre/lib/.

For example, to kill all non-severe logging from struts and the validator,
I put the following lines in the logging.properties file.
org.apache.struts.level=SEVERE
org.apache.commons.validator.level=SEVERE

The servlet container we use takes standard out and writes it to a log file.
So I just log using the SimpleFormatter and the ConsoleHandler.

I don't use the LogManager at all. I use the logging package as is and it
works fine.

Maybe I'm doing something wrong that I'll run into later, but for now
I'm happy with the configuration.

I'm not sure I'm much help with this one.

robert

> -----Original Message-----
> From: news [mailto:news@main.gmane.org]On Behalf Of Vic Cekvenich
> Sent: Wednesday, March 19, 2003 9:17 AM
> To: struts-user@jakarta.apache.org
> Subject: Re: jdk14 log
>
>
>
>
> Navjot Singh wrote:
> > Hi Vic,
> >
> > Properties File Attached. Remember, the logging takes the formatter
> > specified in props if called from command prompt.
> > When i called from servlet, it take XMLFormatter by default.
> However, if you
> > give BasicFormatter, it picks up SimpleFormatter.
> >
> > It just refuses to pick my customer Formatter from Servlet.
> >
> > Use this to read file
> > =============
> >    LogManager logman = LogManager.getLogManager();
> >    FileInputStream in = new FileInputStream(filename);
>
> I am looking for something that would work in a Webapp, formbean, etc.
> Above would not open a file relative to WAR. You would have to use the
> servlet context, to be WAR relative.
> Anyway, no WAR sampleusing jdk1.4 out there, I went back to
> automatic log4j.
>
>
> .V
>
>
>
> >    logman.readConfiguration(in);
> >
> > Use this to test the config set
> > ====================
> >
> >   LogManager manager = LogManager.getLogManager();
> >   // Get all defined loggers
> >   Enumeration names = manager.getLoggerNames();
> >   while (names.hasMoreElements())
> >   {
> >        String loggername = (String)names.nextElement();
> >        Logger logger = manager.getLogger(loggername);
> >
> >        System.out.println("-----------------------");
> >        System.out.println("Logger name: >" + logger.getName() + "<");
> >        System.out.println("Logger level: " + logger.getLevel());
> >
> >        Handler[] hs = logger.getHandlers();
> >        for(int i=0;i<hs.length;i++)
> >        {
> >             System.out.println("\t" + hs[i].toString() + "#" +
> > hs[i].getFormatter() + "->" + hs[i].getEncoding());
> >        }
> >   }
> >
> > ----- Original Message -----
> > From: "Vic Cekvenich" <vc...@basebeans.com>
> > To: "Navjot Singh" <na...@net4india.net>
> > Sent: Tuesday, March 18, 2003 10:46 PM
> > Subject: jdk14 log
> >
> >
> > | Can you send me the properties files and the command that read it?
> > | I am trying to get JDK1.4 log to work in struts.
> > | thanks
> > | .V
> > |
> > |
> > |
> >
> >
> >
> > ------------------------------------------------------------------------
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: jdk14 log

Posted by Vic Cekvenich <vc...@basebeans.com>.

Navjot Singh wrote:
> Hi Vic,
> 
> Properties File Attached. Remember, the logging takes the formatter
> specified in props if called from command prompt.
> When i called from servlet, it take XMLFormatter by default. However, if you
> give BasicFormatter, it picks up SimpleFormatter.
> 
> It just refuses to pick my customer Formatter from Servlet.
> 
> Use this to read file
> =============
>    LogManager logman = LogManager.getLogManager();
>    FileInputStream in = new FileInputStream(filename);

I am looking for something that would work in a Webapp, formbean, etc.
Above would not open a file relative to WAR. You would have to use the 
servlet context, to be WAR relative.
Anyway, no WAR sampleusing jdk1.4 out there, I went back to automatic log4j.


.V



>    logman.readConfiguration(in);
> 
> Use this to test the config set
> ====================
> 
>   LogManager manager = LogManager.getLogManager();
>   // Get all defined loggers
>   Enumeration names = manager.getLoggerNames();
>   while (names.hasMoreElements())
>   {
>        String loggername = (String)names.nextElement();
>        Logger logger = manager.getLogger(loggername);
> 
>        System.out.println("-----------------------");
>        System.out.println("Logger name: >" + logger.getName() + "<");
>        System.out.println("Logger level: " + logger.getLevel());
> 
>        Handler[] hs = logger.getHandlers();
>        for(int i=0;i<hs.length;i++)
>        {
>             System.out.println("\t" + hs[i].toString() + "#" +
> hs[i].getFormatter() + "->" + hs[i].getEncoding());
>        }
>   }
> 
> ----- Original Message -----
> From: "Vic Cekvenich" <vc...@basebeans.com>
> To: "Navjot Singh" <na...@net4india.net>
> Sent: Tuesday, March 18, 2003 10:46 PM
> Subject: jdk14 log
> 
> 
> | Can you send me the properties files and the command that read it?
> | I am trying to get JDK1.4 log to work in struts.
> | thanks
> | .V
> |
> |
> |
> 
> 
> 
> ------------------------------------------------------------------------
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: jdk14 log

Posted by Anand M S <an...@hotmail.com>.
I'm also having probel with jdk logging, I'm not sure how the the following
methods of Logger should work

log(Level level, String msg, Object param1);
log(Level level, String msg, Object[] param1);

If I pass array of objects as a parameters to this method, my understanding
is it should print the
 toString representation to the handlers, but it's not. Documentation says
param1 in above method is parameter to the message, msg is a String, how can
we pass parameter to  string?

any ideas?

Thanks.

----- Original Message -----
From: "Navjot Singh" <na...@net4india.net>
To: "Vic Cekvenich" <vc...@basebeans.com>
Cc: "Struts Users List" <st...@jakarta.apache.org>
Sent: Wednesday, March 19, 2003 3:07 AM
Subject: Re: jdk14 log


>
> Hi Vic,
>
> Properties File Attached. Remember, the logging takes the formatter
> specified in props if called from command prompt.
> When i called from servlet, it take XMLFormatter by default. However, if
you
> give BasicFormatter, it picks up SimpleFormatter.
>
> It just refuses to pick my customer Formatter from Servlet.
>
> Use this to read file
> =============
>    LogManager logman = LogManager.getLogManager();
>    FileInputStream in = new FileInputStream(filename);
>    logman.readConfiguration(in);
>
> Use this to test the config set
> ====================
>
>   LogManager manager = LogManager.getLogManager();
>   // Get all defined loggers
>   Enumeration names = manager.getLoggerNames();
>   while (names.hasMoreElements())
>   {
>        String loggername = (String)names.nextElement();
>        Logger logger = manager.getLogger(loggername);
>
>        System.out.println("-----------------------");
>        System.out.println("Logger name: >" + logger.getName() + "<");
>        System.out.println("Logger level: " + logger.getLevel());
>
>        Handler[] hs = logger.getHandlers();
>        for(int i=0;i<hs.length;i++)
>        {
>             System.out.println("\t" + hs[i].toString() + "#" +
> hs[i].getFormatter() + "->" + hs[i].getEncoding());
>        }
>   }
>
> ----- Original Message -----
> From: "Vic Cekvenich" <vc...@basebeans.com>
> To: "Navjot Singh" <na...@net4india.net>
> Sent: Tuesday, March 18, 2003 10:46 PM
> Subject: jdk14 log
>
>
> | Can you send me the properties files and the command that read it?
> | I am trying to get JDK1.4 log to work in struts.
> | thanks
> | .V
> |
> |
> |
>
>


----------------------------------------------------------------------------
----


> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org