Adams Christian | 4 Aug 2006 13:27
Picon

Bug: char used instead of logchar in patternparser

Hi

I had problems to use umlauts as literal in my patternlayout. I debuged
log4cxx and found that in the file patternparser.cpp in line 116 in the
function PatternParser::parse() char c; should be logchar c;

I changed this for myself and it worked fine. Also I tried to create a
patch, see end of mail.

Greetings

Christian

Index: patternparser.cpp
===================================================================
--- patternparser.cpp	(revision 428276)
+++ patternparser.cpp	(working copy)
 <at>  <at>  -113,7 +113,7  <at>  <at> 

   int patternLength = pattern.length();
   int state = LITERAL_STATE;
-  char c;
+  logchar c;
   int i = 0;
   FormattingInfoPtr formattingInfo(FormattingInfo::getDefault());

siva prasanth | 9 Aug 2006 22:57
Picon
Favicon

Log4CXX - Compile Error

Hi,
 
I am trying to build the log4cxx on SunOS. I build the apr, apr-util and cppunit.
when i try to build the log4cxx,,i am able to compile the code bt during linking i get the follwing error.
 
ld: fatal: library -lsqlite3: not found
ld: fatal: library -liconv: not found
ld: fatal: File processing errors. No output written to .libs/liblog4cxx.so.9.0.0
*** Error code 1
make: Fatal error: Command failed for target `liblog4cxx.la'.
 
The makefile in log4cxx has
APU_LIBS =  -L/usr/local/apr/lib -laprutil-1 -lsqlite3 -lexpat -liconv.
 
and i checked the lib folder under which the apr is installed and it has
 
apr.exp                 libapr-1.so.0          libaprutil-1.so.0      libexpat.so.0
aprutil.exp            libapr-1.so.0.2.7      libaprutil-1.so.0.2.7  libexpat.so.0.1.0
libapr-1.a             libaprutil-1.a         libexpat.a             pkgconfig
libapr-1.la            libaprutil-1.la        libexpat.la
libapr-1.so            libaprutil-1.so        libexpat.so
 
 
Can anyone please let me know how to correct the error.
( looking at the make i feel that the apr/apr-util lib folder should have the
sqlite3.so ??? which i am missing....correct me???)
 
 
 
/Prasanth
 
 
 
 


Regards
Siva Prasanth Kambam

Yahoo! Music Unlimited - Access over 1 million songs. Try it free.
afester | 13 Aug 2006 19:44
Picon
Favicon

svn commit: r431200 - /logging/log4cxx/trunk/build.xml

Author: afester
Date: Sun Aug 13 10:43:59 2006
New Revision: 431200

URL: http://svn.apache.org/viewvc?rev=431200&view=rev
Log:
LOGCXX-147: reflect removal of apr-util-1.2.2.patch in build.xml

Modified:
    logging/log4cxx/trunk/build.xml

Modified: logging/log4cxx/trunk/build.xml
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/build.xml?rev=431200&r1=431199&r2=431200&view=diff
==============================================================================
--- logging/log4cxx/trunk/build.xml (original)
+++ logging/log4cxx/trunk/build.xml Sun Aug 13 10:43:59 2006
 <at>  <at>  -536,9 +536,6  <at>  <at> 
         <param name="module" value="apr-util"/>
         <param name="module.version" value="${aprutil.version}"/>
     </antcall>
-    <patch patchfile="${base.dir}/apr-util-${aprutil.version}.patch"
-           dir="${lib.dir}/apr-util-${aprutil.version}"
-           strip="0"/>
     <chmod file="${lib.dir}/apr-util-${aprutil.version}/xml/expat/configure"
            perm="u+x"/>

afester | 13 Aug 2006 21:52
Picon
Favicon

svn commit: r431216 - /logging/log4cxx/trunk/src/filterbasedtriggeringpolicy.cpp

Author: afester
Date: Sun Aug 13 12:52:21 2006
New Revision: 431216

URL: http://svn.apache.org/viewvc?rev=431216&view=rev
Log:
LOGCXX-14: Added missing enumeration value in switch{} to 
allow gcc option -Wall

Modified:
    logging/log4cxx/trunk/src/filterbasedtriggeringpolicy.cpp

Modified: logging/log4cxx/trunk/src/filterbasedtriggeringpolicy.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/filterbasedtriggeringpolicy.cpp?rev=431216&r1=431215&r2=431216&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/filterbasedtriggeringpolicy.cpp (original)
+++ logging/log4cxx/trunk/src/filterbasedtriggeringpolicy.cpp Sun Aug 13 12:52:21 2006
 <at>  <at>  -47,6 +47,9  <at>  <at> 

       case Filter::ACCEPT:
          return true;
+
+      case Filter::NEUTRAL:
+         break;
     }
   }
   return true;

afester | 13 Aug 2006 21:54
Picon
Favicon

svn commit: r431218 - in /logging/log4cxx/trunk/src: hierarchy.cpp inetaddress.cpp obsoleterollingfileappender.cpp writerappender.cpp

Author: afester
Date: Sun Aug 13 12:54:29 2006
New Revision: 431218

URL: http://svn.apache.org/viewvc?rev=431218&view=rev
Log:
LOGCXX-14: fixed initialization order of members (fix gcc warning
... is initialized before ...)

Modified:
    logging/log4cxx/trunk/src/hierarchy.cpp
    logging/log4cxx/trunk/src/inetaddress.cpp
    logging/log4cxx/trunk/src/obsoleterollingfileappender.cpp
    logging/log4cxx/trunk/src/writerappender.cpp

Modified: logging/log4cxx/trunk/src/hierarchy.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/hierarchy.cpp?rev=431218&r1=431217&r2=431218&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/hierarchy.cpp (original)
+++ logging/log4cxx/trunk/src/hierarchy.cpp Sun Aug 13 12:54:29 2006
 <at>  <at>  -40,8 +40,9  <at>  <at> 
 IMPLEMENT_LOG4CXX_OBJECT(Hierarchy)

 Hierarchy::Hierarchy(const LoggerPtr& root1) : root(root1),
+thresholdInt(Level::ALL_INT), threshold(Level::getAll()),
 emittedNoAppenderWarning(false), emittedNoResourceBundleWarning(false),
-mutex(), configured(false), thresholdInt(Level::ALL_INT), threshold(Level::getAll())
+mutex(), configured(false)
 {
         this->root->setHierarchy(this);
         defaultFactory = new DefaultCategoryFactory();

Modified: logging/log4cxx/trunk/src/inetaddress.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/inetaddress.cpp?rev=431218&r1=431217&r2=431218&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/inetaddress.cpp (original)
+++ logging/log4cxx/trunk/src/inetaddress.cpp Sun Aug 13 12:54:29 2006
 <at>  <at>  -42,7 +42,7  <at>  <at> 

 
 InetAddress::InetAddress(const LogString& hostName, const LogString& hostAddr) 
-    : hostNameString(hostName), ipAddrString(hostAddr) {
+    : ipAddrString(hostAddr), hostNameString(hostName) {
 }

Modified: logging/log4cxx/trunk/src/obsoleterollingfileappender.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/obsoleterollingfileappender.cpp?rev=431218&r1=431217&r2=431218&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/obsoleterollingfileappender.cpp (original)
+++ logging/log4cxx/trunk/src/obsoleterollingfileappender.cpp Sun Aug 13 12:54:29 2006
 <at>  <at>  -39,17 +39,16  <at>  <at> 

 
 RollingFileAppender::RollingFileAppender()
-   : rfa(new log4cxx::rolling::RollingFileAppender()),
-     maxFileSize(10*1024*1024), maxBackupIndex(1) {
+   : maxFileSize(10*1024*1024), maxBackupIndex(1),
+     rfa(new log4cxx::rolling::RollingFileAppender()) {
 }

 RollingFileAppender::RollingFileAppender(
   const LayoutPtr& layout,
   const LogString& filename,
   bool append)
-  : rfa(new log4cxx::rolling::RollingFileAppender()),
-  maxFileSize(10*1024*1024),
-  maxBackupIndex(1)  {
+  : maxFileSize(10*1024*1024), maxBackupIndex(1),
+    rfa(new log4cxx::rolling::RollingFileAppender()) {
   rfa->setLayout(layout);
   rfa->setFile(filename);
   rfa->setAppend(append);
 <at>  <at>  -59,9 +58,8  <at>  <at> 

 RollingFileAppender::RollingFileAppender(const LayoutPtr& layout,
    const LogString& filename)
-   : rfa(new log4cxx::rolling::RollingFileAppender()),
-   maxFileSize(10*1024*1024),
-   maxBackupIndex(1) {
+   : maxFileSize(10*1024*1024), maxBackupIndex(1),
+     rfa(new log4cxx::rolling::RollingFileAppender()) {
   rfa->setLayout(layout);
   rfa->setFile(filename);
   Pool pool;

Modified: logging/log4cxx/trunk/src/writerappender.cpp
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/writerappender.cpp?rev=431218&r1=431217&r2=431218&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/writerappender.cpp (original)
+++ logging/log4cxx/trunk/src/writerappender.cpp Sun Aug 13 12:54:29 2006
 <at>  <at>  -32,7 +32,7  <at>  <at> 

 WriterAppender::WriterAppender(const LayoutPtr& layout1,
                log4cxx::helpers::WriterPtr& writer1)
-    : AppenderSkeleton(layout1), writer(writer1), immediateFlush(true) {
+    : AppenderSkeleton(layout1), immediateFlush(true), writer(writer1) {
       Pool p;
       activateOptions(p);
 }

afester | 13 Aug 2006 21:56
Picon
Favicon

svn commit: r431220 - /logging/log4cxx/trunk/include/log4cxx/rolling/fixedwindowrollingpolicy.h

Author: afester
Date: Sun Aug 13 12:56:03 2006
New Revision: 431220

URL: http://svn.apache.org/viewvc?rev=431220&view=rev
Log:
LOGCXX-14: fixed initialization order of members (fix gcc warning
... is initialized before ...)

Modified:
    logging/log4cxx/trunk/include/log4cxx/rolling/fixedwindowrollingpolicy.h

Modified: logging/log4cxx/trunk/include/log4cxx/rolling/fixedwindowrollingpolicy.h
URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/include/log4cxx/rolling/fixedwindowrollingpolicy.h?rev=431220&r1=431219&r2=431220&view=diff
==============================================================================
--- logging/log4cxx/trunk/include/log4cxx/rolling/fixedwindowrollingpolicy.h (original)
+++ logging/log4cxx/trunk/include/log4cxx/rolling/fixedwindowrollingpolicy.h Sun Aug 13
12:56:03 2006
 <at>  <at>  -72,8 +72,8  <at>  <at> 
                   LOG4CXX_CAST_ENTRY_CHAIN(RollingPolicyBase)
           END_LOG4CXX_CAST_MAP()

-          int maxIndex;
           int minIndex;
+          int maxIndex;
           bool explicitActiveFile;

           /**


Jostein Tveit | 24 Aug 2006 18:31
Picon
Picon
Favicon

ActiveFileName in TimeBasedRollingPolicy

Hello log4cxx developers,

Is ActiveFileName implemented as described in
include/log4cxx/rolling/timebasedrollingpolicy.h?

Or is the comment a cut-n-paste from log4j source code?

I would very much like the following configuration to work as
expected:

  <appender name="FILE" class="org.apache.log4j.rolling.RollingFileAppender">
    <rollingPolicy class="org.apache.log4j.rolling.TimeBasedRollingPolicy">
      <param name="FileNamePattern" value="log/server.log-%d{yyyy-MM-dd}"/>
      <param name="ActiveFileName" value="log/server.log"/>
    </rollingPolicy>

    <layout class="org.apache.log4j.PatternLayout">
      <param name="ConversionPattern" value="%c{1} - %m%n"/>
    </layout>   
  </appender>

Regards,
--

-- 
Jostein Tveit <josteitv <at> pvv.ntnu.no>

Jostein Tveit | 24 Aug 2006 19:23
Picon
Picon
Favicon

Re: ActiveFileName in TimeBasedRollingPolicy

Jostein Tveit <josteitv <at> pvv.ntnu.no> writes:

> I would very much like the following configuration to work as
> expected:
>
>   <appender name="FILE" class="org.apache.log4j.rolling.RollingFileAppender">
>     <rollingPolicy class="org.apache.log4j.rolling.TimeBasedRollingPolicy">
>       <param name="FileNamePattern" value="log/server.log-%d{yyyy-MM-dd}"/>
>       <param name="ActiveFileName" value="log/server.log"/>
>     </rollingPolicy>
>
>     <layout class="org.apache.log4j.PatternLayout">
>       <param name="ConversionPattern" value="%c{1} - %m%n"/>
>     </layout>   
>   </appender>

This config is probably what I want:

   <appender name="FILE" class="org.apache.log4j.rolling.RollingFileAppender">
     <rollingPolicy class="org.apache.log4j.rolling.TimeBasedRollingPolicy">
       <param name="FileNamePattern" value="log/server.log-%d{yyyy-MM-dd}"/>
     </rollingPolicy>

     <layout class="org.apache.log4j.PatternLayout">
       <param name="ConversionPattern" value="%c{1} - %m%n"/>
     </layout>

     <param name="file" value="log/server.log"/>
     <param name="append" value="false"/>
   </appender>

It seems to do what I wanted to do.

--

-- 
Jostein Tveit <josteitv <at> pvv.ntnu.no>

Adams Christian | 31 Aug 2006 11:58
Picon

Which effort would it be to make SocketAppender run?

Hello,
 
I use log4cxx and now would like to use the SocketAppender. But I found that some code is commented out or disabled with #if 0 ... #endif.
Also I found that the reason for this is the change from hard coded char to logchar which could be char or wchar_t.
Also I found that mainly socketinputstream.cpp has to be fixed to get socketappender runing. Is that correct?
 
Can someone tell me what I would have to do to get socketappender to run?
 
Greetings
 
Christian Adams
 
Adams Christian | 31 Aug 2006 15:35
Picon

Possible fix for DOMConfigurator

Hello
I have a problem with asyncappender and wrote a mail to log4cxx user
mailinglist:
http://marc.theaimsgroup.com/?l=log4cxx-user&m=115701692131918&w=2

But now I don't think this is a configuration problem. I think it is a
bug in the domconfigurator. For testing I added the param apr_xml_doc*
doc to findAppenderByName().
So now this method is possible to call parseAppender() with doc as
second parameter and not 0. I did this because parseAppender wasn't able
to find the appender which should be added to the asyncappender and now
with the doc pointer it is able to find the appender. This works for me
fine and also the configuration like shown in my mail in the user - list
works.
For the case that this is a good solution I will add diff for
domconfigurator.h and .cpp. But I only have tested this for the one
case, described in me mail in log4cxx user list. I don't know the
possible effects for other situations.

Greetings

Christian

Index: domconfigurator.h
===================================================================
--- domconfigurator.h	(revision 438834)
+++ domconfigurator.h	(working copy)
 <at>  <at>  -95,7 +95,8  <at>  <at> 
                         */
                         AppenderPtr findAppenderByName(apr_xml_elem*
elem,
                                 const LogString& appenderName,
-                                AppenderMap& appenders);
+                                AppenderMap& appenders,
+                                apr_xml_doc* doc);

                         /**
                         Used internally to parse appenders by IDREF
element.

Index: domconfigurator.cpp
===================================================================
--- domconfigurator.cpp	(revision 438834)
+++ domconfigurator.cpp	(working copy)
 <at>  <at>  -112,19 +112,20  <at>  <at> 
 */
 AppenderPtr DOMConfigurator::findAppenderByName(apr_xml_elem* element, 
                                                 const LogString&
appenderName,
-                                                AppenderMap& appenders)
{
+                                                AppenderMap& appenders,
+                                                apr_xml_doc* doc) {
     AppenderPtr appender;
     std::string tagName(element->name);
     if (tagName == APPENDER_TAG) {
         if (appenderName == getAttribute(element, NAME_ATTR)) {
-              appender = parseAppender(element, 0, appenders);
+              appender = parseAppender(element, doc, appenders);
         }
     }
     if (element->first_child && !appender) {
-         appender = findAppenderByName(element->first_child,
appenderName, appenders);
+         appender = findAppenderByName(element->first_child,
appenderName, appenders, doc);
     }
     if (element->next && !appender) {
-        appender = findAppenderByName(element->next, appenderName,
appenders);
+        appender = findAppenderByName(element->next, appenderName,
appenders, doc);
     }
     return appender;
 }
 <at>  <at>  -142,7 +143,7  <at>  <at> 
         if (match != appenders.end()) {
             appender = match->second;
         } else if (doc) {
-            appender = findAppenderByName(doc->root, appenderName,
appenders);
+            appender = findAppenderByName(doc->root, appenderName,
appenders, doc);
             if (appender) {
                 appenders.insert(AppenderMap::value_type(appenderName,
appender));
             }


Gmane