[Ace-users] Re: [ace-bugs] ACE_Log_Record::print
Johnny Willemsen
jwillemsen at remedy.nl
Mon Jun 25 06:24:10 CDT 2007
Hi,
Thanks for usign the PRF form, can you test this patch below, this is the
same code as in Log_Msg.cpp
Regards,
Johnny Willemsen
Remedy IT
Postbus 101
2650 AC Berkel en Rodenrijs
The Netherlands
www.theaceorb.nl / www.remedy.nl
*** Integrated compile and test statistics see
http://scoreboard.theaceorb.nl ***
*** Commercial service and support for ACE/TAO/CIAO ***
*** See http://www.theaceorb.nl/en/support.html ***
#if !defined (ACE_WIN32) && defined (ACE_USES_WCHAR)
int fwrite_result = ACE_OS::fprintf (fp,
ACE_LIB_TEXT ("%ls"),
verbose_msg);
#else
int fwrite_result = ACE_OS::fprintf (fp,
ACE_LIB_TEXT ("%s"),
verbose_msg);
#endif
> -----Original Message-----
> From: ace-bugs-bounces at cse.wustl.edu
> [mailto:ace-bugs-bounces at cse.wustl.edu] On Behalf Of Hofmann,
> Christoph
> Sent: Monday, June 25, 2007 1:19 PM
> To: ace-bugs at cs.wustl.edu
> Subject: [ace-bugs] ACE_Log_Record::print
>
> ACE VERSION: 5.5.8
>
> HOST MACHINE and OPERATING SYSTEM:
> P4 with Suse Linux 10.2
>
> TARGET MACHINE and OPERATING SYSTEM, if different from HOST:
> COMPILER NAME AND VERSION (AND PATCHLEVEL): gcc 4.02
>
> THE $ACE_ROOT/ace/config.h FILE :
> #define ACE_HAS_LINUX_NPTL
> #define ACE_USES_MUTEX_FOR_PROCESS_MUTEX #define
> ACE_HAS_NONSTATIC_OBJECT_MANAGER #define
> ACE_DOESNT_INSTANTIATE_NONSTATIC_OBJECT_MANAGER
> #define ACE_USES_WCHAR
> #include "ace/config-linux.h"
>
> THE $ACE_ROOT/include/makeinclude/platform_macros.GNU FILE :
> LN_S = zwick-ln
> optimize=0
> debug=1
>
> ZWICK_BUILDSUBDIR=linux/debug
>
> VDIR=$(ZWICK_BUILDSUBDIR)/obj/
> VSHDIR=$(ZWICK_BUILDSUBDIR)/shobj/
>
> INSLIB=$(ZWICK_BIN)/$(ZWICK_BUILDSUBDIR)
> INSBIN=$(ZWICK_BIN)/$(ZWICK_BUILDSUBDIR)
>
> include $(ACE_ROOT)/include/makeinclude/platform_linux.GNU
>
> SHLIB=$(ZWICK_BUILDSUBDIR)/$(SHLIB_UNCHECKED)
>
> BIN_TMP=$(ZWICK_BUILDSUBDIR)/$(BIN_UNCHECKED)
> BIN_UNCHECKED:=$(BIN_TMP)
>
> CPPFLAGS += -Werror -Wno-unused-parameter -Wextra #CPPFLAGS +=
> -ftest-coverage -fprofile-arcs LDFLAGS += -Wl,-rpath
> -Wl,$(ZWICK_BIN)/$(ZWICK_BUILDSUBDIR)
>
> TAO_IDL := $(HOST_ROOT)/bin/tao_idl
> TAO_IDLFLAGS += -g $(HOST_ROOT)/bin/gperf TAO_IDL_DEP :=
> $(HOST_ROOT)/bin/tao_idl$(EXEEXT)
>
>
>
> CONTENTS OF
> $ACE_ROOT/bin/MakeProjectCreator/config/default.features
> ???
>
> AREA/CLASS/EXAMPLE AFFECTED:
> Log_Record.cpp
>
> DOES THE PROBLEM AFFECT:
> COMPILATION?
> No
> LINKING?
> No
> EXECUTION?
> YES
> OTHER (please specify)?
> both
>
> SYNOPSIS:
> If ACE_USES_WCHAR is set, ACE_DEBUG does not work on Linux.
>
> DESCRIPTION:
> I know that ACE_USES_WCHAR is not tested on linux. But I
> found a bug and
> a potential solution.
> If ACE_USES_WCHAR is set, ACE_DEBUG does not work on Linux.
>
> REPEAT BY:
>
> SAMPLE FIX/WORKAROUND:
> see my workaround also in attached file.
>
>
>
>
>
> int
> ACE_Log_Record::print (const ACE_TCHAR host_name[],
> u_long verbose_flag,
> FILE *fp)
> {
> if (ACE_LOG_MSG->log_priority_enabled (ACE_Log_Priority
> (this->type_)))
> {
> ACE_TCHAR *verbose_msg = 0;
> ACE_NEW_RETURN (verbose_msg,
> ACE_TCHAR[MAXVERBOSELOGMSGLEN], -1);
>
> int result = this->format_msg (host_name,
> verbose_flag,
> verbose_msg);
>
> if (result == 0)
> {
> if (fp != 0)
> {
> int verbose_msg_len =
> static_cast<int> (ACE_OS::strlen (verbose_msg));
> //************************************************************
> **********
> **
> // Hofmann-Patch: if Linux and WCHAR, "%ls" is needed
> //************************************************************
> **********
> **
> #if defined (ACE_WIN32) || !defined (ACE_USES_WCHAR)
> int fwrite_result = ACE_OS::fprintf (fp,
>
> ACE_LIB_TEXT ("%s"),
> verbose_msg);
> #else
> int fwrite_result = ACE_OS::fprintf (fp,
>
> ACE_LIB_TEXT ("%ls"),
> verbose_msg);
> #endif
> //************************************************************
> **********
> **
> // Hofmann-Patch finished
> //************************************************************
> **********
> **
> // We should have written everything
> if (fwrite_result != verbose_msg_len)
> result = -1;
> else
> ACE_OS::fflush (fp);
> }
> }
>
> delete [] verbose_msg;
>
> return result;
> }
> else
> return 0;
> }
>
More information about the Ace-users
mailing list