Re: [xwiki-users] Fwd: Redirecting logs to a file instead of console on tomcat?

2012-04-21 Thread mohit gupta
Thanks Sergiu.

On Thu, Apr 19, 2012 at 11:27 PM, Sergiu Dumitriu  wrote:

> On 04/19/2012 01:51 PM, mohit gupta wrote:
>
>> Now as per 
>> http://logback.qos.ch/manual/**joran.html,
>>  i tried to use file
>> Appender to log the message to file* but no help*. Here is added code
>>
>> snippet in logback.xml
>>
>>  
>> myApp.log
>>
>
> You should use an absolute file path, since this filename could end up
> anywhere, depending on how Tomcat was started and what it considers the
> "current directory". Make sure the location you provide is writable by the
> owner of the tomcat process.
>
>  
>>
>
> ^ typo here, ConsoleAppender[t]
>
>
>%date %level [%thread] %logger{10} [%file:%line]
>> %msg%n
>> 
>>   
>>
>>  
>> 
>>  
>>
>> -- Forwarded message --
>> From: mohit gupta
>> Date: Thu, Apr 19, 2012 at 10:06 PM
>> Subject: Redirecting logs to a file instead of console on tomcat?
>> To: XWiki Users
>>
>>
>> I have gone thru
>> http://platform.xwiki.org/**xwiki/bin/view/AdminGuide/**Logging.
>> As per
>> logback.xml(inside in MyApp/WEB_INF/classes), looks like it relies on the
>> fact that container will redirect all the console to logfile
>> automaticcaly.
>> But it is not happening. I am using tomcat 6.  i want to put all the
>> possible logs i.e  log.info.log.warn,log.error,**log.debug,log.fatal
>> inside
>> log file
>>
>> For logging i am using below code snippet
>> private static final Log log =
>> org.apache.commons.logging.**LogFactory.getLog(**
>> AuthServiceImpl.class);//
>> declared as insiance variable under AuthServiceImpl.class
>>
>
> You shouldn't use commons-logging, but slf4j:
>
> private static final Logger LOGGER = LoggerFactory.getLogger(**
> AuthServiceImpl.class);
>
> I don't understand what you mean by "declared as instance variable". If
> it's "static final", then it's not an instance variable, but a static
> constant member.
>
>
>  then in my public method i am doing the logging as
>>
>> log.error("Testing AuthServiceImpl  Reply = ");
>>
>> But its printing the  logs on tomcat console. Guys really i have no idea
>> how to print the  to file instead of console.Inside logback.xml(inside in
>> MyApp/WEB_INF/classes)
>> i can see below  setting. I have really no idea what is happening?
>>
>> Thanks in advance.
>>
>
>
> --
> Sergiu Dumitriu
> http://purl.org/net/sergiu/
> __**_
> users mailing list
> users@xwiki.org
> http://lists.xwiki.org/**mailman/listinfo/users
>
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] Fwd: Redirecting logs to a file instead of console on tomcat?

2012-04-19 Thread Sergiu Dumitriu

On 04/19/2012 01:51 PM, mohit gupta wrote:

Now as per http://logback.qos.ch/manual/joran.html , i tried to use file
Appender to log the message to file* but no help*. Here is added code
snippet in logback.xml

  
 myApp.log


You should use an absolute file path, since this filename could end up 
anywhere, depending on how Tomcat was started and what it considers the 
"current directory". Make sure the location you provide is writable by 
the owner of the tomcat process.



 


^ typo here, ConsoleAppender[t]


   %date %level [%thread] %logger{10} [%file:%line]
%msg%n
 
   

  
 
  

-- Forwarded message --
From: mohit gupta
Date: Thu, Apr 19, 2012 at 10:06 PM
Subject: Redirecting logs to a file instead of console on tomcat?
To: XWiki Users


I have gone thru
http://platform.xwiki.org/xwiki/bin/view/AdminGuide/Logging. As per
logback.xml(inside in MyApp/WEB_INF/classes), looks like it relies on the
fact that container will redirect all the console to logfile automaticcaly.
But it is not happening. I am using tomcat 6.  i want to put all the
possible logs i.e  log.info.log.warn,log.error,log.debug,log.fatal inside
log file

For logging i am using below code snippet
private static final Log log =
org.apache.commons.logging.LogFactory.getLog(AuthServiceImpl.class);//
declared as insiance variable under AuthServiceImpl.class


You shouldn't use commons-logging, but slf4j:

private static final Logger LOGGER = 
LoggerFactory.getLogger(AuthServiceImpl.class);


I don't understand what you mean by "declared as instance variable". If 
it's "static final", then it's not an instance variable, but a static 
constant member.



then in my public method i am doing the logging as

log.error("Testing AuthServiceImpl  Reply = ");

But its printing the  logs on tomcat console. Guys really i have no idea
how to print the  to file instead of console.Inside logback.xml(inside in
MyApp/WEB_INF/classes)
i can see below  setting. I have really no idea what is happening?

Thanks in advance.



--
Sergiu Dumitriu
http://purl.org/net/sergiu/
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


[xwiki-users] Fwd: Redirecting logs to a file instead of console on tomcat?

2012-04-19 Thread mohit gupta
Now as per http://logback.qos.ch/manual/joran.html , i tried to use file
Appender to log the message to file* but no help*. Here is added code
snippet in logback.xml

 
myApp.log


  %date %level [%thread] %logger{10} [%file:%line]
%msg%n

  

 

 

-- Forwarded message --
From: mohit gupta 
Date: Thu, Apr 19, 2012 at 10:06 PM
Subject: Redirecting logs to a file instead of console on tomcat?
To: XWiki Users 


I have gone thru
http://platform.xwiki.org/xwiki/bin/view/AdminGuide/Logging. As per
logback.xml(inside in MyApp/WEB_INF/classes), looks like it relies on the
fact that container will redirect all the console to logfile automaticcaly.
But it is not happening. I am using tomcat 6.  i want to put all the
possible logs i.e  log.info.log.warn,log.error,log.debug,log.fatal inside
log file

For logging i am using below code snippet
private static final Log log =
org.apache.commons.logging.LogFactory.getLog(AuthServiceImpl.class);//
declared as insiance variable under AuthServiceImpl.class

then in my public method i am doing the logging as

log.error("Testing AuthServiceImpl  Reply = ");

But its printing the  logs on tomcat console. Guys really i have no idea
how to print the  to file instead of console.Inside logback.xml(inside in
MyApp/WEB_INF/classes)
i can see below  setting. I have really no idea what is happening?

Thanks in advance.
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users