You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Rainer Hirschmiller <ra...@web.de> on 2012/11/24 19:37:17 UTC

log4j2 and encoding

Hi,

I'm using Windows 7, Java 7 and Log4j2 beta3 and Eclipse Juno.

I'm reading data from a database and log the data for checking. The data 
contain German special characters. These data are displayed well in the 
application, e.g. in tables, but wrong while logging the data.

  The application reports Cp1252 as used charset.

I tried to set file.encoding in the run configuration / arguments to 
-Dfile.encoding=ISO-8859-1 but the reported charset is not changed.

Is this a problem of log4j2? Or do I make something wrong?

Regards
Rainer

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


回复: log4j2 and encoding

Posted by hualuoxiangxi <hu...@hotmail.com>.
hi,
I'm using Windows 7, Java 7 and Log4j2 beta3 and Eclipse Juno.

A error occured when  I tried to run the example  application named  MyApp.
I found the logger of variable is not static, so can't use it in static main Function direction.
There is a picture  of   marked  named configuration on attachment.


hualuoxiangxi

From: Rainer Hirschmiller
Date: 2012-11-25 02:37
To: log4j-user
Subject: log4j2 and encoding
Hi,

I'm using Windows 7, Java 7 and Log4j2 beta3 and Eclipse Juno.

I'm reading data from a database and log the data for checking. The data 
contain German special characters. These data are displayed well in the 
application, e.g. in tables, but wrong while logging the data.

  The application reports Cp1252 as used charset.

I tried to set file.encoding in the run configuration / arguments to 
-Dfile.encoding=ISO-8859-1 but the reported charset is not changed.

Is this a problem of log4j2? Or do I make something wrong?

Regards
Rainer

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

Re: log4j2 and encoding

Posted by Rainer Hirschmiller <ra...@web.de>.
Yeah, that's it. I saw this in documentation, but in the first tries I 
make some stupid things. Which following pattern definition it works:
       <PatternLayout pattern="%d{HH:mm:ss,SSS z} %thread %-5level 
%file:%method:%line - %message%n" charset="ISO-8859-1" />

Thanks for the fast help
Rainer



Am 25.11.2012 06:13, schrieb Ralph Goers:
> Most Layouts accept a charset attribute. You should try specifying "ISO-8859-1" there.  If that doesn't work please let us know.
>
> Ralph
>
> On Nov 24, 2012, at 11:37 AM, Rainer Hirschmiller wrote:
>
>> Hi,
>>
>> I'm using Windows 7, Java 7 and Log4j2 beta3 and Eclipse Juno.
>>
>> I'm reading data from a database and log the data for checking. The data contain German special characters. These data are displayed well in the application, e.g. in tables, but wrong while logging the data.
>>
>> The application reports Cp1252 as used charset.
>>
>> I tried to set file.encoding in the run configuration / arguments to -Dfile.encoding=ISO-8859-1 but the reported charset is not changed.
>>
>> Is this a problem of log4j2? Or do I make something wrong?
>>
>> Regards
>> Rainer
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>


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


Re: log4j2 and encoding

Posted by Ralph Goers <ra...@dslextreme.com>.
Most Layouts accept a charset attribute. You should try specifying "ISO-8859-1" there.  If that doesn't work please let us know.

Ralph

On Nov 24, 2012, at 11:37 AM, Rainer Hirschmiller wrote:

> Hi,
> 
> I'm using Windows 7, Java 7 and Log4j2 beta3 and Eclipse Juno.
> 
> I'm reading data from a database and log the data for checking. The data contain German special characters. These data are displayed well in the application, e.g. in tables, but wrong while logging the data.
> 
> The application reports Cp1252 as used charset.
> 
> I tried to set file.encoding in the run configuration / arguments to -Dfile.encoding=ISO-8859-1 but the reported charset is not changed.
> 
> Is this a problem of log4j2? Or do I make something wrong?
> 
> Regards
> Rainer
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 


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


Re: log4j2 and encoding

Posted by Ralph Goers <ra...@dslextreme.com>.
Where are you finding MyApp?  A class with that name occurs in several places on the web site. Many of them are meant to be code fragments and are not full applications.

Ralph

On Nov 24, 2012, at 6:41 PM, Feng Ye wrote:

> I'm using Windows 7, Java 7 and Log4j2 beta3 and Eclipse Juno.
>  
> A error occured when  I tried to run the example  application named  MyApp.
> I found the logger of variable is not static, so can't use it in static main Function direction.
>  
> 
>  
> -----邮件原件-----
> 发件人: Rainer Hirschmiller [mailto:rainer.hirschmiller@web.de] 
> 发送时间: 2012年11月25日 2:37
> 收件人: log4j-user@logging.apache.org
> 主题: log4j2 and encoding
>  
> Hi,
>  
> I'm using Windows 7, Java 7 and Log4j2 beta3 and Eclipse Juno.
>  
> I'm reading data from a database and log the data for checking. The data
> contain German special characters. These data are displayed well in the
> application, e.g. in tables, but wrong while logging the data.
>  
>   The application reports Cp1252 as used charset.
>  
> I tried to set file.encoding in the run configuration / arguments to
> -Dfile.encoding=ISO-8859-1 but the reported charset is not changed.
>  
> Is this a problem of log4j2? Or do I make something wrong?
>  
> Regards
> Rainer
>  
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>  


答复: log4j2 and encoding

Posted by Feng Ye <hu...@hotmail.com>.
I'm using Windows 7, Java 7 and Log4j2 beta3 and Eclipse Juno.

 

A error occured when  I tried to run the example  application named  MyApp.

I found the logger of variable is not static, so can't use it in static main
Function direction.

 



 

-----邮件原件-----
发件人: Rainer Hirschmiller [mailto:rainer.hirschmiller@web.de] 
发送时间: 2012年11月25日 2:37
收件人: log4j-user@logging.apache.org
主题: log4j2 and encoding

 

Hi,

 

I'm using Windows 7, Java 7 and Log4j2 beta3 and Eclipse Juno.

 

I'm reading data from a database and log the data for checking. The data 

contain German special characters. These data are displayed well in the 

application, e.g. in tables, but wrong while logging the data.

 

  The application reports Cp1252 as used charset.

 

I tried to set file.encoding in the run configuration / arguments to 

-Dfile.encoding=ISO-8859-1 but the reported charset is not changed.

 

Is this a problem of log4j2? Or do I make something wrong?

 

Regards

Rainer

 

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

To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org

For additional commands, e-mail: log4j-user-help@logging.apache.org

 


回复: log4j2 and encoding

Posted by hualuoxiangxi <hu...@hotmail.com>.
hi,
I'm using Windows 7, Java 7 and Log4j2 beta3 and Eclipse Juno.

A error occured when  I tried to run the example  application named  MyApp.
I found the logger of variable is not static, so can't use it in static main Function direction.






hualuoxiangxi

From: Rainer Hirschmiller
Date: 2012-11-25 02:37
To: log4j-user
Subject: log4j2 and encoding
Hi,

I'm using Windows 7, Java 7 and Log4j2 beta3 and Eclipse Juno.

I'm reading data from a database and log the data for checking. The data 
contain German special characters. These data are displayed well in the 
application, e.g. in tables, but wrong while logging the data.

  The application reports Cp1252 as used charset.

I tried to set file.encoding in the run configuration / arguments to 
-Dfile.encoding=ISO-8859-1 but the reported charset is not changed.

Is this a problem of log4j2? Or do I make something wrong?

Regards
Rainer

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

回复: log4j2 and encoding

Posted by hualuoxiangxi <hu...@hotmail.com>.
I'm using Windows 7, Java 7 and Log4j2 beta3 and Eclipse Juno.

A error occured when  I tried to run the example  application named  MyApp.
I found the logger of variable is not static, so can't use it in static main Function direction.





hualuoxiangxi

From: Rainer Hirschmiller
Date: 2012-11-25 02:37
To: log4j-user
Subject: log4j2 and encoding
Hi,

I'm using Windows 7, Java 7 and Log4j2 beta3 and Eclipse Juno.

I'm reading data from a database and log the data for checking. The data 
contain German special characters. These data are displayed well in the 
application, e.g. in tables, but wrong while logging the data.

  The application reports Cp1252 as used charset.

I tried to set file.encoding in the run configuration / arguments to 
-Dfile.encoding=ISO-8859-1 but the reported charset is not changed.

Is this a problem of log4j2? Or do I make something wrong?

Regards
Rainer

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