You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4cxx-user@logging.apache.org by Mattias Brändström <th...@brasse.org> on 2004/09/03 10:56:15 UTC
Strings and configuration (unrelated to each other)
Hello!
I have two questions about the log4cxx API.
First of all, when I configure log4cxx in the following way:
log4cxx::PropertyConfigurator::configure(string("/usr"));
it fails silently. Is this the way it is supposed to behave? I would
have preffered it to say something similar to what it says when I point
it to a file that edoes not exist.
My second question is about the String class. In the examples I have
seen strings are constructed with _T(). Where is this function declared?
Where is String declared? Will it be OK for me to send strings to
log4cxx using std::string?
Thanks in advance!
Regards,
Mattias
Re: Strings and configuration (unrelated to each other)
Posted by Christophe de VIENNE <cd...@alphacent.com>.
Mattias Brändström a écrit :
> Hello!
>
> I have two questions about the log4cxx API.
>
> First of all, when I configure log4cxx in the following way:
>
> log4cxx::PropertyConfigurator::configure(string("/usr"));
>
> it fails silently. Is this the way it is supposed to behave?
I think so.
> I would have preffered it to say something similar to what it says
> when I point it to a file that edoes not exist.
>
> My second question is about the String class. In the examples I have
> seen strings are constructed with _T(). Where is this function declared?
This is a macro used by gettext for internationalisation. cf gettext
documentation for more information.
> Where is String declared?
helper/tchar.h:
310 typedef std::basic_string<TCHAR> String;
> Will it be OK for me to send strings to log4cxx using std::string?
Yes, if TCHAR is a char, then String is equivalent to std::string.
Regards,
--
Christophe de Vienne
Re: Strings and configuration (unrelated to each other)
Posted by Curt Arnold <ca...@apache.org>.
On Sep 3, 2004, at 3:56 AM, Mattias Brändström wrote:
> Hello!
>
> I have two questions about the log4cxx API.
>
> First of all, when I configure log4cxx in the following way:
>
> log4cxx::PropertyConfigurator::configure(string("/usr"));
>
> it fails silently. Is this the way it is supposed to behave? I would
> have preffered it to say something similar to what it says when I
> point it to a file that edoes not exist.
Don't know that one off the top of my head
>
> My second question is about the String class. In the examples I have
> seen strings are constructed with _T(). Where is this function
> declared? Where is String declared? Will it be OK for me to send
> strings to log4cxx using std::string?
I've been assigned to rework the Unicode support and will dive into as
soon as I finish my current project. The bug report
(http://nagoya.apache.org/jira/browse/LOGCXX-10) has more details. _T
is a preprocessor macro defined in log4cxx/helpers/tchar.h (patterned
after Windows tchar.h) that wraps the string literal with a L so make
it a long string literal if UNICODE is defined. Currently log4cxx only
supports logging Unicode or MBCS, in my rework, it can support both
simultaneously. I expect to remove the _T macro from log4cxx (since it
can be inconsistent with the Windows tchar.h definition) and would
avoid using it in new code. String is an alias for std::string unless
UNICODE is set when it is an alias for std::wstring. So if you pass
char* or std::string's to log4cxx, you should see no changes when I've
finished the Unicode rework.