carnold 2004/10/26 11:12:29
Modified: . build.xml
include/log4cxx config_msvc.h.in stream.h
include/log4cxx/db odbcappender.h
include/log4cxx/helpers socketimpl.h tchar.h
include/log4cxx/nt outputdebugstringappender.h
include/log4cxx/spi/location locationinfo.h
src condition.cpp criticalsection.cpp dateformat.cpp
event.cpp locationinfo.cpp msxml.cpp
stringtokenizer.cpp thread.cpp
threadspecificdata.cpp
tests/src .cvsignore streamtestcase.cpp
tests/src/net socketservertestcase.cpp
tests/src/util filenamefilter.cpp xmlfilenamefilter.cpp
Log:
LOGCXX-34: Visual Studio 6 build broken
Revision Changes Path
1.3 +373 -351 logging-log4cxx/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/logging-log4cxx/build.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- build.xml 22 Oct 2004 04:46:34 -0000 1.2
+++ build.xml 26 Oct 2004 18:12:28 -0000 1.3
@@ -1,351 +1,373 @@
-<?xml version="1.0"?>
-<!--
- Copyright 2004 The Apache Software Foundation.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
--->
-
-<!--
-
-This file builds log4cxx using Apache Ant (http://ant.apache.org)
-and the C++ compilation tasks from http://ant-contrib.sourceforge.net.
-
-
--->
-<project name="log4cxx" default="test-all">
-
-<property name="debug" value="true"/>
-<property name="compiler" value="gcc"/>
-<property name="src.dir" location="src"/>
-<property name="include.dir" location="include"/>
-<property name="build.dir" location="build"/>
-<property name="examples.dir" location="examples"/>
-<property name="tests.dir" location="tests"/>
-<property name="cppunit.dir" location="/home/curta/cppunit-1.10.2"/>
-<property name="cppunit.include.dir"
location="/home/curta/cppunit-1.10.2/include"/>
-<property name="cppunit.lib.dir"
location="/home/curta/cppunit-1.10.2/build"/>
-<property name="cppunit.bin.dir"
location="/home/curta/cppunit-1.10.2/build"/>
-
-<property name="version" value="0.9.7"/>
-<taskdef resource="cpptasks.tasks"/>
-<typedef resource="cpptasks.types"/>
-
-<target name="usage">
- <echo>
- </echo>
-</target>
-
-<target name="os-detect">
- <condition property="is-unix" value="true">
- <os family="unix"/>
- </condition>
- <condition property="is-windows" value="true">
- <os family="windows"/>
- </condition>
-</target>
-
-<target name="win-init" depends="os-detect" if="is-windows">
- <property name="compiler" value="msvc"/>
- <condition property="lib-suffix" value="d">
- <istrue value="${debug}"/>
- </condition>
- <property name="lib-suffix" value=""/>
-</target>
-
-<target name="unix-init" depends="os-detect" if="is-unix">
- <property name="compiler" value="gcc"/>
- <condition property="is-gcc" value="true">
- <or>
- <equals arg1="${compiler}" arg2="gcc"/>
- <equals arg1="${compiler}" arg2="g++"/>
- </or>
- </condition>
-
- <property name="lib-suffix" value="-${version}"/>
-</target>
-
-<target name="init" depends="win-init, unix-init">
- <mkdir dir="${build.dir}"/>
- <condition property="obj.dir" value="${build.dir}/debug">
- <istrue value="${debug}"/>
- </condition>
- <property name="obj.dir" value="${build.dir}/release"/>
- <mkdir dir="${obj.dir}"/>
-</target>
-
-<target name="clean">
- <delete dir="${build.dir}"/>
-</target>
-
-<target name="config-check">
- <condition property="config-available" value="true">
- <available file="${include.dir}/log4cxx/config_auto.h"/>
- </condition>
-</target>
-
-
-<target name="unix-prep" depends="init, config-check"
- if="is-unix"
- unless="config-available">
- <exec executable="sh">
- <arg value="./autogen.sh"/>
- </exec>
- <exec executable="sh">
- <arg value="./configure"/>
- </exec>
-</target>
-
-
-
-<target name="win-prep" depends="init, config-check"
- if="is-windows"
- unless="config-available">
- <echo file="${include.dir}/log4cxx/config.h">#include "config_msvc.h"
-</echo>
-</target>
-
-<target name="prep" depends="unix-prep, win-prep"/>
-
-<target name="build-log4cxx" depends="prep" description="Build log4cxx
shared library">
- <cc name="${compiler}"
- exceptions="true"
- outfile="${build.dir}/log4cxx${lib-suffix}"
- subsystem="console"
- multithreaded="true"
- outtype="shared"
- objdir="${obj.dir}"
- debug="${debug}">
- <fileset dir="${src.dir}" includes="*.cpp"/>
- <includepath path="${include.dir}"/>
- <includepath path="/usr/include/libxml2" if="is-unix"/>
- <defineset define="_USRDLL DLL_EXPORTS" if="is-windows"/>
- <defineset define="LOG4CXX"/>
- <libset libs="advapi32 odbc32 ws2_32" if="is-windows"/>
- <libset libs="stdc++" if="is-gcc"/>
- <libset libs="xml2" if="is-unix"/>
- <syslibset libs="pthread" if="is-unix"/>
- <project outfile="cbx/log4cxx" type="cbuilderx" if="gen-cbx"/>
- <project outfile="msvc/log4cxx" type="msvc6" if="gen-dsw"/>
- <project outfile="xcode/log4cxx" type="xcode" if="gen-xcode"/>
- </cc>
-</target>
-
-
-<target name="build-example" description="Build example template task">
- <cc name="${compiler}"
- exceptions="true"
- outfile="${build.dir}/${example.name}"
- subsystem="console"
- multithreaded="true"
- outtype="executable"
- objdir="${obj.dir}"
- debug="${debug}">
- <fileset dir="${example.src.dir}" includes="${example.name}.cpp"/>
- <includepath path="${include.dir}"/>
- <libset libs="log4cxx${lib-suffix}" dir="${build.dir}"/>
- <libset libs="stdc++" if="is-gcc"/>
- <project outfile="cbx/${example.name}" type="cbuilderx"
if="gen-cbx"/>
- <project outfile="msvc/${example.name}" type="msvc6" if="gen-dsw"/>
- <project outfile="xcode/${example.name}" type="xcode"
if="gen-xcode"/>
- </cc>
-</target>
-
-<target name="build-delayedloop" depends="build-log4cxx">
- <antcall target="build-example">
- <param name="example.src.dir" value="${examples.dir}"/>
- <param name="example.name" value="delayedloop"/>
- </antcall>
-</target>
-
-<target name="build-trivial" depends="build-log4cxx">
- <antcall target="build-example">
- <param name="example.src.dir" value="${examples.dir}"/>
- <param name="example.name" value="trivial"/>
- </antcall>
-</target>
-
-<target name="build-stream" depends="build-log4cxx">
- <antcall target="build-example">
- <param name="example.src.dir" value="${examples.dir}"/>
- <param name="example.name" value="stream"/>
- </antcall>
-</target>
-
-<target name="build-examples" depends="build-delayedloop, build-trivial,
build-stream"/>
-
-<target name="build-simplesocketserver" depends="build-log4cxx">
- <antcall target="build-example">
- <param name="example.src.dir" value="simplesocketserver"/>
- <param name="example.name" value="simplesocketserver"/>
- </antcall>
-</target>
-
-<target name="build-performance" depends="build-log4cxx">
- <cc name="${compiler}"
- exceptions="true"
- outfile="${build.dir}/performance"
- subsystem="console"
- multithreaded="true"
- outtype="executable"
- objdir="${obj.dir}"
- debug="${debug}">
- <fileset dir="performance" includes="**/*.cpp"/>
- <includepath path="${include.dir}"/>
- <libset libs="log4cxx${lib-suffix}" dir="${build.dir}"/>
- <libset libs="stdc++" if="is-gcc"/>
- <project outfile="cbx/performance" type="cbuilderx" if="gen-cbx"/>
- <project outfile="msvc/performance" type="msvc6" if="gen-dsw"/>
- <project outfile="xcode/performance" type="xcode" if="gen-xcode"/>
- </cc>
-</target>
-
-
-<target name="build-unittest" depends="build-log4cxx">
- <cc name="${compiler}"
- exceptions="true"
- outfile="${build.dir}/log4cxx-test"
- subsystem="console"
- multithreaded="true"
- outputfileproperty="log4cxx-test.exe"
- outtype="executable"
- objdir="${obj.dir}"
- debug="${debug}">
- <fileset dir="${tests.dir}/src" includes="**/*.cpp">
- <exclude name="shortsocketserver.cpp"/>
- <exclude name="defaultinit/testcase3.cpp"/>
- </fileset>
- <includepath path="${cppunit.include.dir}"/>
- <includepath path="${include.dir}"/>
- <libset libs="log4cxx${lib-suffix}" dir="${build.dir}"/>
- <libset libs="stdc++" if="is-gcc"/>
- <libset libs="boost_regex-gcc" if="is-gcc"/>
- <libset libs="cppunit" dir="${cppunit.lib.dir}"/>
- <project outfile="cbx/log4cxx-test" type="cbuilderx" if="gen-cbx"/>
- <project outfile="msvc/log4cxx-test" type="msvc6" if="gen-dsw"/>
- <project outfile="xcode/log4cxx-test" type="xcode" if="gen-xcode"/>
- </cc>
-
- <!-- testcase3 checks default configuration so must be run in isolation
-->
- <cc name="${compiler}"
- exceptions="true"
- outfile="${build.dir}/log4cxx-testcase3"
- subsystem="console"
- multithreaded="true"
- outputfileproperty="log4cxx-testcase3.exe"
- outtype="executable"
- objdir="${obj.dir}"
- debug="${debug}">
- <fileset dir="${tests.dir}/src">
- <include name="main.cpp"/>
- <include name="defaultinit/testcase3.cpp"/>
- </fileset>
- <includepath path="${cppunit.include.dir}"/>
- <includepath path="${include.dir}"/>
- <libset libs="log4cxx${lib-suffix}" dir="${build.dir}"/>
- <libset libs="stdc++" if="is-gcc"/>
- <libset libs="boost_regex-gcc" if="is-gcc"/>
- <libset libs="cppunit" dir="${cppunit.lib.dir}"/>
- <project outfile="cbx/log4cxx-testcase3" type="cbuilderx"
if="gen-cbx"/>
- <project outfile="msvc/log4cxx-testcase3" type="msvc6" if="gen-dsw"/>
- <project outfile="xcode/log4cxx-testcase3" type="xcode"
if="gen-xcode"/>
- </cc>
-
-
- <cc name="${compiler}"
- exceptions="true"
- outfile="${tests.dir}/src/shortsocketserver"
- subsystem="console"
- multithreaded="true"
- outputfileproperty="shortsocketserver.exe"
- outtype="executable"
- objdir="${obj.dir}"
- debug="${debug}">
- <fileset dir="${tests.dir}/src">
- <include name="shortsocketserver.cpp"/>
- <include name="xml/xlevel.cpp"/>
- </fileset>
- <includepath path="${cppunit.include.dir}"/>
- <includepath path="${include.dir}"/>
- <libset libs="log4cxx${lib-suffix}" dir="${build.dir}"/>
- <libset libs="stdc++" if="is-gcc"/>
- <libset libs="boost_regex-gcc" if="is-gcc"/>
- <libset libs="cppunit" dir="${cppunit.lib.dir}"/>
- <project outfile="cbx/tests" type="cbuilderx" if="gen-cbx"/>
- <project outfile="msvc/tests" type="msvc6" if="gen-dsw"/>
- <project outfile="xcode/tests" type="xcode" if="gen-xcode"/>
- </cc>
-
-</target>
-
-<target name="build-all" depends="build-examples, build-unittest,
- build-simplesocketserver, build-performance"/>
-
-<target name="run-unittest" depends="build-unittest">
- <property environment="env"/>
- <mkdir dir="${tests.dir}/output"/>
- <exec executable="${log4cxx-test.exe}" dir="${tests.dir}"
- failonerror="true">
- <env key="LD_LIBRARY_PATH"
-
value="${build.dir}:${cppunit.bin.dir}:${env.LD_LIBRARY_PATH}"/>
- </exec>
-
- <!-- test use of log4j.configuration -->
- <property name="defaultInit3.properties"
- location="${tests.dir}/input/defaultInit3.properties"/>
- <exec executable="${log4cxx-testcase3.exe}" dir="${tests.dir}"
- failonerror="true">
- <env key="LD_LIBRARY_PATH"
-
value="${build.dir}:${cppunit.bin.dir}:${env.LD_LIBRARY_PATH}"/>
- <env key="log4j.configuration"
- value="${defaultInit3.properties}"/>
- </exec>
-
- <!-- test of LOG4CXX_CONFIGURATION -->
- <exec executable="${log4cxx-testcase3.exe}" dir="${tests.dir}"
- failonerror="true">
- <env key="LD_LIBRARY_PATH"
-
value="${build.dir}:${cppunit.bin.dir}:${env.LD_LIBRARY_PATH}"/>
- <env key="LOG4CXX_CONFIGURATION"
- value="${defaultInit3.properties}"/>
- </exec>
-
- <!-- test of log4j.properties -->
- <mkdir dir="${build.dir}/output"/>
- <delete file="${build.dir}/log4*.properties"/>
- <delete file="${build.dir}/log4*.xml"/>
- <copy tofile="${build.dir}/log4j.properties"
- file="${defaultInit3.properties}" overwrite="true"/>
- <exec executable="${log4cxx-testcase3.exe}" dir="${build.dir}"
- failonerror="true">
- <env key="LD_LIBRARY_PATH"
-
value="${build.dir}:${cppunit.bin.dir}:${env.LD_LIBRARY_PATH}"/>
- </exec>
-
- <!-- modify log4j.properties so if it has precedence the test fails -->
- <replace file="${build.dir}/log4j.properties" token="D3" value="D4"/>
- <copy tofile="${build.dir}/log4cxx.properties"
- file="${defaultInit3.properties}"/>
- <exec executable="${log4cxx-testcase3.exe}" dir="${build.dir}"
- failonerror="true">
- <env key="LD_LIBRARY_PATH"
-
value="${build.dir}:${cppunit.bin.dir}:${env.LD_LIBRARY_PATH}"/>
- </exec>
-
-
-</target>
-
-
-<target name="test-all" depends="build-log4cxx, run-unittest"/>
-
-</project>
+<?xml version="1.0"?>
+<!--
+ Copyright 2004 The Apache Software Foundation.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+
+<!--
+
+This file builds log4cxx using Apache Ant (http://ant.apache.org)
+and the C++ compilation tasks from http://ant-contrib.sourceforge.net.
+
+
+-->
+<project name="log4cxx" default="test-all">
+
+<property name="debug" value="true"/>
+<property name="src.dir" location="src"/>
+<property name="include.dir" location="include"/>
+<property name="build.dir" location="build"/>
+<property name="examples.dir" location="examples"/>
+<property name="tests.dir" location="tests"/>
+
+<property name="version" value="0.9.7"/>
+<taskdef resource="cpptasks.tasks"/>
+<typedef resource="cpptasks.types"/>
+
+<target name="usage">
+ <echo>
+ </echo>
+</target>
+
+<target name="os-detect">
+ <condition property="is-unix" value="true">
+ <os family="unix"/>
+ </condition>
+ <condition property="is-windows" value="true">
+ <os family="windows"/>
+ </condition>
+</target>
+
+<target name="win-init" depends="os-detect" if="is-windows">
+ <property name="compiler" value="msvc"/>
+ <condition property="lib-suffix" value="d">
+ <istrue value="${debug}"/>
+ </condition>
+ <property name="lib-suffix" value=""/>
+ <property name="cppunit.dir" location="/cppunit-1.10.2"/>
+ <property name="cppunit.include.dir" location="${cppunit.dir}/include"/>
+ <property name="cppunit.lib.dir" location="${cppunit.dir}/lib"/>
+ <property name="cppunit.bin.dir" location="${cppunit.dir}/lib"/>
+ <property name="boost.include.dir" location="\boost_1_31_0"/>
+</target>
+
+<target name="unix-init" depends="os-detect" if="is-unix">
+ <property name="compiler" value="gcc"/>
+ <condition property="is-gcc" value="true">
+ <or>
+ <equals arg1="${compiler}" arg2="gcc"/>
+ <equals arg1="${compiler}" arg2="g++"/>
+ </or>
+ </condition>
+
+ <property name="lib-suffix" value="-${version}"/>
+
+ <property name="cppunit.dir" location="/home/curta/cppunit-1.10.2"/>
+ <property name="cppunit.include.dir" location="${cppunit.dir}/include"/>
+ <property name="cppunit.lib.dir" location="${cppunit.dir}/build"/>
+ <property name="cppunit.bin.dir" location="${cppunit.dir}/build"/>
+</target>
+
+<target name="init" depends="win-init, unix-init">
+ <mkdir dir="${build.dir}"/>
+ <condition property="obj.dir" value="${build.dir}/debug">
+ <istrue value="${debug}"/>
+ </condition>
+ <property name="obj.dir" value="${build.dir}/release"/>
+ <mkdir dir="${obj.dir}"/>
+</target>
+
+<target name="clean">
+ <delete dir="${build.dir}"/>
+ <delete>
+ <fileset dir="${tests.dir}/src" includes="shortsocket*"
excludes="*.cpp"/>
+ <fileset dir="${tests.dir}/output"/>
+ </delete>
+</target>
+
+<target name="config-check">
+ <condition property="config-available" value="true">
+ <available file="${include.dir}/log4cxx/config_auto.h"/>
+ </condition>
+</target>
+
+
+<target name="unix-prep" depends="init, config-check"
+ if="is-unix"
+ unless="config-available">
+ <exec executable="sh">
+ <arg value="./autogen.sh"/>
+ </exec>
+ <exec executable="sh">
+ <arg value="./configure"/>
+ </exec>
+</target>
+
+<target name="check-config-msvc" depends="init" if="is-windows">
+ <condition property="config-msvc-available" value="true">
+ <available file="${include.dir}/log4cxx/config_msvc.h"/>
+ </condition>
+</target>
+
+<target name="prep-config-msvc" depends="check-config-msvc" if="is-windows">
+ <copy tofile="${include.dir}/log4cxx/config_msvc.h"
file="${include.dir}/log4cxx/config_msvc.h.in"/>
+ <replace file="${include.dir}/log4cxx/config_msvc.h" token="@VERSION@"
value="${version}"/>
+</target>
+
+
+<target name="win-prep" depends="init, config-check, prep-config-msvc"
+ if="is-windows"
+ unless="config-available">
+ <echo file="${include.dir}/log4cxx/config.h">#include "config_msvc.h"
+</echo>
+</target>
+
+<target name="prep" depends="unix-prep, win-prep"/>
+
+<target name="build-log4cxx" depends="prep" description="Build log4cxx
shared library">
+ <cc name="${compiler}"
+ exceptions="true"
+ outfile="${build.dir}/log4cxx${lib-suffix}"
+ subsystem="console"
+ multithreaded="true"
+ outtype="shared"
+ objdir="${obj.dir}"
+ debug="${debug}">
+ <fileset dir="${src.dir}" includes="*.cpp"/>
+ <includepath path="${include.dir}"/>
+ <includepath path="/usr/include/libxml2" if="is-unix"/>
+ <defineset define="_USRDLL DLL_EXPORTS" if="is-windows"/>
+ <defineset define="LOG4CXX"/>
+ <libset libs="advapi32 odbc32 ws2_32" if="is-windows"/>
+ <libset libs="stdc++" if="is-gcc"/>
+ <libset libs="xml2" if="is-unix"/>
+ <syslibset libs="pthread" if="is-unix"/>
+ <project outfile="cbx/log4cxx" type="cbuilderx" if="gen-cbx"/>
+ <project outfile="msvc/log4cxx" type="msvc6" if="gen-dsw"/>
+ <project outfile="xcode/log4cxx" type="xcode" if="gen-xcode"/>
+ </cc>
+</target>
+
+
+<target name="build-example" description="Build example template task">
+ <cc name="${compiler}"
+ exceptions="true"
+ outfile="${build.dir}/${example.name}"
+ subsystem="console"
+ multithreaded="true"
+ outtype="executable"
+ objdir="${obj.dir}"
+ debug="${debug}">
+ <fileset dir="${example.src.dir}" includes="${example.name}.cpp"/>
+ <includepath path="${include.dir}"/>
+ <libset libs="log4cxx${lib-suffix}" dir="${build.dir}"/>
+ <libset libs="stdc++" if="is-gcc"/>
+ <project outfile="cbx/${example.name}" type="cbuilderx"
if="gen-cbx"/>
+ <project outfile="msvc/${example.name}" type="msvc6" if="gen-dsw"/>
+ <project outfile="xcode/${example.name}" type="xcode"
if="gen-xcode"/>
+ </cc>
+</target>
+
+<target name="build-delayedloop" depends="build-log4cxx">
+ <antcall target="build-example">
+ <param name="example.src.dir" value="${examples.dir}"/>
+ <param name="example.name" value="delayedloop"/>
+ </antcall>
+</target>
+
+<target name="build-trivial" depends="build-log4cxx">
+ <antcall target="build-example">
+ <param name="example.src.dir" value="${examples.dir}"/>
+ <param name="example.name" value="trivial"/>
+ </antcall>
+</target>
+
+<target name="build-stream" depends="build-log4cxx">
+ <antcall target="build-example">
+ <param name="example.src.dir" value="${examples.dir}"/>
+ <param name="example.name" value="stream"/>
+ </antcall>
+</target>
+
+<target name="build-examples" depends="build-delayedloop, build-trivial,
build-stream"/>
+
+<target name="build-simplesocketserver" depends="build-log4cxx">
+ <antcall target="build-example">
+ <param name="example.src.dir" value="simplesocketserver"/>
+ <param name="example.name" value="simplesocketserver"/>
+ </antcall>
+</target>
+
+<target name="build-performance" depends="build-log4cxx">
+ <cc name="${compiler}"
+ exceptions="true"
+ outfile="${build.dir}/performance"
+ subsystem="console"
+ multithreaded="true"
+ outtype="executable"
+ objdir="${obj.dir}"
+ debug="${debug}">
+ <fileset dir="performance" includes="**/*.cpp"/>
+ <includepath path="${include.dir}"/>
+ <libset libs="log4cxx${lib-suffix}" dir="${build.dir}"/>
+ <libset libs="stdc++" if="is-gcc"/>
+ <project outfile="cbx/performance" type="cbuilderx" if="gen-cbx"/>
+ <project outfile="msvc/performance" type="msvc6" if="gen-dsw"/>
+ <project outfile="xcode/performance" type="xcode" if="gen-xcode"/>
+ </cc>
+</target>
+
+
+<target name="build-unittest" depends="build-log4cxx">
+ <cc name="${compiler}"
+ exceptions="true"
+ outfile="${build.dir}/log4cxx-test"
+ subsystem="console"
+ multithreaded="true"
+ outputfileproperty="log4cxx-test.exe"
+ outtype="executable"
+ objdir="${obj.dir}"
+ debug="${debug}">
+ <fileset dir="${tests.dir}/src" includes="**/*.cpp">
+ <exclude name="shortsocketserver.cpp"/>
+ <exclude name="defaultinit/testcase3.cpp"/>
+ </fileset>
+ <includepath path="${cppunit.include.dir}"/>
+ <includepath path="${include.dir}"/>
+ <includepath path="${boost.include.dir}"
if="boost.include.dir"/>
+ <libset libs="log4cxx${lib-suffix}" dir="${build.dir}"/>
+ <libset libs="stdc++" if="is-gcc"/>
+ <libset libs="boost_regex-gcc" if="is-gcc"/>
+ <libset libs="cppunit${lib-suffix}" dir="${cppunit.lib.dir}"/>
+ <project outfile="cbx/log4cxx-test" type="cbuilderx" if="gen-cbx"/>
+ <project outfile="msvc/log4cxx-test" type="msvc6" if="gen-dsw"/>
+ <project outfile="xcode/log4cxx-test" type="xcode" if="gen-xcode"/>
+ </cc>
+
+ <!-- testcase3 checks default configuration so must be run in isolation
-->
+ <cc name="${compiler}"
+ exceptions="true"
+ outfile="${build.dir}/log4cxx-testcase3"
+ subsystem="console"
+ multithreaded="true"
+ outputfileproperty="log4cxx-testcase3.exe"
+ outtype="executable"
+ objdir="${obj.dir}"
+ debug="${debug}">
+ <fileset dir="${tests.dir}/src">
+ <include name="main.cpp"/>
+ <include name="defaultinit/testcase3.cpp"/>
+ </fileset>
+ <includepath path="${cppunit.include.dir}"/>
+ <includepath path="${include.dir}"/>
+ <libset libs="log4cxx${lib-suffix}" dir="${build.dir}"/>
+ <libset libs="stdc++" if="is-gcc"/>
+ <libset libs="boost_regex-gcc" if="is-gcc"/>
+ <libset libs="cppunit${lib-suffix}" dir="${cppunit.lib.dir}"/>
+ <project outfile="cbx/log4cxx-testcase3" type="cbuilderx"
if="gen-cbx"/>
+ <project outfile="msvc/log4cxx-testcase3" type="msvc6" if="gen-dsw"/>
+ <project outfile="xcode/log4cxx-testcase3" type="xcode"
if="gen-xcode"/>
+ </cc>
+
+
+ <cc name="${compiler}"
+ exceptions="true"
+ outfile="${tests.dir}/src/shortsocketserver"
+ subsystem="console"
+ multithreaded="true"
+ outputfileproperty="shortsocketserver.exe"
+ outtype="executable"
+ objdir="${obj.dir}"
+ debug="${debug}">
+ <fileset dir="${tests.dir}/src">
+ <include name="shortsocketserver.cpp"/>
+ <include name="xml/xlevel.cpp"/>
+ </fileset>
+ <includepath path="${cppunit.include.dir}"/>
+ <includepath path="${include.dir}"/>
+ <libset libs="log4cxx${lib-suffix}" dir="${build.dir}"/>
+ <libset libs="stdc++" if="is-gcc"/>
+ <libset libs="boost_regex-gcc" if="is-gcc"/>
+ <libset libs="cppunit${lib-suffix}" dir="${cppunit.lib.dir}"/>
+ <project outfile="cbx/shortsocketserver" type="cbuilderx"
if="gen-cbx"/>
+ <project outfile="msvc/shortsocketserver" type="msvc6" if="gen-dsw"/>
+ <project outfile="xcode/shortsocketserver" type="xcode"
if="gen-xcode"/>
+ </cc>
+
+</target>
+
+<target name="build-all" depends="build-examples, build-unittest,
+ build-simplesocketserver, build-performance"/>
+
+<target name="run-unittest" depends="build-unittest">
+ <property environment="env"/>
+ <mkdir dir="${tests.dir}/output"/>
+ <exec executable="${log4cxx-test.exe}" dir="${tests.dir}"
+ failonerror="true">
+ <env key="LD_LIBRARY_PATH"
+
value="${build.dir}:${cppunit.bin.dir}:${env.LD_LIBRARY_PATH}"/>
+ <env key="Path"
+ value="${build.dir};${env.Path}"/>
+ </exec>
+
+ <!-- test use of log4j.configuration -->
+ <property name="defaultInit3.properties"
+ location="${tests.dir}/input/defaultInit3.properties"/>
+ <exec executable="${log4cxx-testcase3.exe}" dir="${tests.dir}"
+ failonerror="true">
+ <env key="LD_LIBRARY_PATH"
+
value="${build.dir}:${cppunit.bin.dir}:${env.LD_LIBRARY_PATH}"/>
+ <env key="log4j.configuration"
+ value="${defaultInit3.properties}"/>
+ </exec>
+
+ <!-- test of LOG4CXX_CONFIGURATION -->
+ <exec executable="${log4cxx-testcase3.exe}" dir="${tests.dir}"
+ failonerror="true">
+ <env key="LD_LIBRARY_PATH"
+
value="${build.dir}:${cppunit.bin.dir}:${env.LD_LIBRARY_PATH}"/>
+ <env key="LOG4CXX_CONFIGURATION"
+ value="${defaultInit3.properties}"/>
+ </exec>
+
+ <!-- test of log4j.properties -->
+ <mkdir dir="${build.dir}/output"/>
+ <delete file="${build.dir}/log4*.properties"/>
+ <delete file="${build.dir}/log4*.xml"/>
+ <copy tofile="${build.dir}/log4j.properties"
+ file="${defaultInit3.properties}" overwrite="true"/>
+ <exec executable="${log4cxx-testcase3.exe}" dir="${build.dir}"
+ failonerror="true">
+ <env key="LD_LIBRARY_PATH"
+
value="${build.dir}:${cppunit.bin.dir}:${env.LD_LIBRARY_PATH}"/>
+ </exec>
+
+ <!-- modify log4j.properties so if it has precedence the test fails -->
+ <replace file="${build.dir}/log4j.properties" token="D3" value="D4"/>
+ <copy tofile="${build.dir}/log4cxx.properties"
+ file="${defaultInit3.properties}"/>
+ <exec executable="${log4cxx-testcase3.exe}" dir="${build.dir}"
+ failonerror="true">
+ <env key="LD_LIBRARY_PATH"
+
value="${build.dir}:${cppunit.bin.dir}:${env.LD_LIBRARY_PATH}"/>
+ </exec>
+
+
+</target>
+
+
+<target name="test-all" depends="build-log4cxx, run-unittest"/>
+
+</project>
1.5 +9 -9 logging-log4cxx/include/log4cxx/config_msvc.h.in
Index: config_msvc.h.in
===================================================================
RCS file: /home/cvs/logging-log4cxx/include/log4cxx/config_msvc.h.in,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- config_msvc.h.in 13 Aug 2004 12:27:45 -0000 1.4
+++ config_msvc.h.in 26 Oct 2004 18:12:28 -0000 1.5
@@ -5,27 +5,26 @@
#define VERSION "@VERSION@"
/* Define to 1 if you have the `ftime' function. */
-#define HAVE_FTIME 1
+#define LOG4CXX_HAVE_FTIME 1
/* ODBC support through Microsoft ODBC. */
-#define HAVE_MS_ODBC 1
+#define LOG4CXX_HAVE_MS_ODBC 1
/* thread support through Microsoft threads. */
-#define HAVE_MS_THREAD 1
+#define LOG4CXX_HAVE_MS_THREAD 1
/* XML support through Microsoft XML. */
-#define HAVE_MS_XML 1
+#define LOG4CXX_HAVE_MS_XML 1
/* ODBC support */
-#define HAVE_ODBC 1
+#define LOG4CXX_HAVE_ODBC 1
/* thread support */
-#define HAVE_THREAD 1
+#define LOG4CXX_HAVE_THREAD 1
/* XML support */
-#define HAVE_XML 1
+#define LOG4CXX_HAVE_XML 1
-/*
typedef __int64 int64_t;
#if defined(WIN32) || defined(_WIN32)
@@ -57,4 +56,5 @@
#endif
#define _WIN32_WINNT 0x0400
-*/
+
+#include <tchar.h>
\ No newline at end of file
1.4 +101 -53 logging-log4cxx/include/log4cxx/stream.h
Index: stream.h
===================================================================
RCS file: /home/cvs/logging-log4cxx/include/log4cxx/stream.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- stream.h 25 Oct 2004 04:37:33 -0000 1.3
+++ stream.h 26 Oct 2004 18:12:28 -0000 1.4
@@ -39,7 +39,10 @@
logger(loggr),
currentLevel(level),
impl(0),
- enabled(loggr->isEnabledFor(level)) {
+ enabled(loggr->isEnabledFor(level)) {
+#if defined(_MSC_VER)
+ _Init();
+#endif
}
/**
@@ -51,6 +54,9 @@
currentLevel(level),
impl(0),
enabled(logger->isEnabledFor(level)) {
+#if defined(_MSC_VER)
+ _Init();
+#endif
}
~basic_logstream() {
@@ -85,15 +91,14 @@
- void flush(const ::log4cxx::spi::location::LocationInfo&
location) {
+ inline void flush(const ::log4cxx::spi::location::LocationInfo&
location) {
if (LOG4CXX_UNLIKELY(enabled && 0 != impl)) {
- ::std::basic_string<Elem, Tr> msg(impl->str());
logger->log(currentLevel,
- msg,
+ impl->str(),
location.getFileName(),
location.getLineNumber());
- msg.clear();
- impl->str(msg);
+ const std::basic_string<Elem, Tr>
emptyStr;
+ impl->str(emptyStr);
}
}
@@ -124,60 +129,103 @@
typedef basic_logstream<char> logstream;
typedef basic_logstream<wchar_t> wlogstream;
} // namespace log4cxx
-
-
-
-
-/**
-* Insertion operator for LocationInfo.
-*
-*/
-template<class Elem, class Tr>
-::log4cxx::basic_logstream<Elem, Tr>& operator<<(
- ::log4cxx::basic_logstream<Elem, Tr>& lhs,
- const ::log4cxx::spi::location::LocationInfo& rhs) {
- lhs.setLocation(rhs);
- return lhs;
-}
-
-/**
-* Insertion operator for LocationFlush.
-*
-*/
-template<class Elem, class Tr>
-::log4cxx::basic_logstream<Elem, Tr>& operator<<(
- ::log4cxx::basic_logstream<Elem, Tr>& lhs,
- const ::log4cxx::spi::location::LocationFlush& rhs) {
- lhs.flush(rhs);
- return lhs;
-}
-
-
-/**
-* Insertion operator for Level.
-*
-*/
-template<class Elem, class Tr>
-::log4cxx::basic_logstream<Elem, Tr>& operator<<(
- ::log4cxx::basic_logstream<Elem, Tr>& lhs,
- const ::log4cxx::LevelPtr& rhs) {
- lhs.setLevel(rhs);
- return lhs;
-}
-
-
-//
-//
-// template for manipulators (std::scientific et al)
+
+
+
+//
+// Insertion operators for LocationInfo, LocationFlush, Level and
+// manipulators (std::fixed and similar)
+//
+// Visual C++ 6 and earlier do not implement template partial ordering
+// (see http://support.microsoft.com/default.aspx?scid=kb;en-us;240869)
+// resulting in error C2667 unless the non-template definitions for
+// operator<< (LOG4CXX_DEFINE_LOCATION_INSERTION and similar) are
provided.
//
+
+#define LOG4CXX_DEFINE_LOCATION_INSERTION(streamtype) \
+streamtype& operator<<(streamtype& lhs, \
+const ::log4cxx::spi::location::LocationInfo& rhs) { \
+ lhs.setLocation(rhs); \
+ return lhs; \
+}
+
+
+#define LOG4CXX_DEFINE_FLUSH_INSERTION(streamtype) \
+streamtype& operator<<(streamtype& lhs, \
+const ::log4cxx::spi::location::LocationFlush& rhs) { \
+ lhs.flush(rhs); \
+ return lhs; \
+}
+
+
+
+#define LOG4CXX_DEFINE_LEVEL_INSERTION(streamtype) \
+streamtype& operator<<(streamtype& lhs, \
+const ::log4cxx::LevelPtr& rhs) { \
+ lhs.setLevel(rhs); \
+ return lhs; \
+}
+
+
+#define LOG4CXX_DEFINE_MANIPULATOR_INSERTION(streamtype) \
+streamtype& operator<<( \
+ streamtype& lhs, \
+::std::ios_base& (*manip)(::std::ios_base&)) { \
+ (*manip)(lhs); \
+ return lhs; \
+}
+
+#if _MSC_VER_ < 1300
+LOG4CXX_DEFINE_LOCATION_INSERTION(::log4cxx::logstream)
+LOG4CXX_DEFINE_LOCATION_INSERTION(::log4cxx::wlogstream)
+
+
+LOG4CXX_DEFINE_FLUSH_INSERTION(::log4cxx::logstream)
+//LOG4CXX_DEFINE_FLUSH_INSERTION(::log4cxx::wlogstream)
+
+LOG4CXX_DEFINE_LEVEL_INSERTION(::log4cxx::logstream)
+LOG4CXX_DEFINE_LEVEL_INSERTION(::log4cxx::wlogstream)
+
+LOG4CXX_DEFINE_MANIPULATOR_INSERTION(::log4cxx::logstream)
+LOG4CXX_DEFINE_MANIPULATOR_INSERTION(::log4cxx::wlogstream)
+#else
+
+template<class Elem, class Tr>
+::log4cxx::basic_logstream<Elem, Tr>& operator<<(
+ ::log4cxx::basic_logstream<Elem, Tr>& lhs,
+ const ::log4cxx::spi::location::LocationInfo& rhs) {
+ lhs.setLocation(rhs);
+ return lhs;
+}
+
+
+template<class Elem, class Tr>
+::log4cxx::basic_logstream<Elem, Tr>& operator<<(
+ ::log4cxx::basic_logstream<Elem, Tr>& lhs,
+ const ::log4cxx::spi::location::LocationFlush& rhs) {
+ lhs.flush(rhs);
+ return lhs;
+}
+
+template<class Elem, class Tr>
+::log4cxx::basic_logstream<Elem, Tr>& operator<<(
+ ::log4cxx::basic_logstream<Elem, Tr>& lhs,
+ const ::log4cxx::LevelPtr& rhs) {
+ lhs.setLevel(rhs);
+ return lhs;
+}
+
+
template<class Elem, class Tr>
::log4cxx::basic_logstream<Elem, Tr>& operator<<(
::log4cxx::basic_logstream<Elem, Tr>& lhs,
::std::ios_base& (*manip)(::std::ios_base&)) {
(*manip)(lhs);
return lhs;
-}
-
+}
+#endif
+
+
//
1.15 +10 -3 logging-log4cxx/include/log4cxx/db/odbcappender.h
Index: odbcappender.h
===================================================================
RCS file: /home/cvs/logging-log4cxx/include/log4cxx/db/odbcappender.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- odbcappender.h 22 Oct 2004 15:13:36 -0000 1.14
+++ odbcappender.h 26 Oct 2004 18:12:28 -0000 1.15
@@ -39,9 +39,16 @@
class LOG4CXX_EXPORT SQLException : public helpers::Exception
{
public:
- SQLException(int code) : code(code) {}
- virtual String getMessage() const { return String(); }
-
+ SQLException(int code) : code(code) {}
+ SQLException(const SQLException& src) : Exception(src),
code(src.code) {
+ }
+ const char* what() const throw() {
+ return "SQLException";
+ }
+ virtual ~SQLException() throw() {}
+
+ private:
+ SQLException& operator=(const SQLException&);
int code;
};
1.14 +1 -1 logging-log4cxx/include/log4cxx/helpers/socketimpl.h
Index: socketimpl.h
===================================================================
RCS file: /home/cvs/logging-log4cxx/include/log4cxx/helpers/socketimpl.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- socketimpl.h 25 Oct 2004 04:44:03 -0000 1.13
+++ socketimpl.h 26 Oct 2004 18:12:28 -0000 1.14
@@ -53,7 +53,7 @@
}
virtual ~SocketMessageTooLargeException() throw() {}
const char* what() const throw() {
- "Incoming message too large";
+ return "Incoming message too large";
}
private:
1.40 +8 -7 logging-log4cxx/include/log4cxx/helpers/tchar.h
Index: tchar.h
===================================================================
RCS file: /home/cvs/logging-log4cxx/include/log4cxx/helpers/tchar.h,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- tchar.h 13 Aug 2004 12:27:46 -0000 1.39
+++ tchar.h 26 Oct 2004 18:12:28 -0000 1.40
@@ -75,12 +75,12 @@
return os;
}
}
-
+
#ifdef LOG4CXX_MUST_UNDEF_T
#undef _T
#endif
-#ifdef WIN32
+#ifdef _WIN32
#ifndef USES_CONVERSION
#include <malloc.h>
#define USES_CONVERSION void * _dst = _alloca(1024);
@@ -112,11 +112,11 @@
#define totlower towlower
#define tcout std::wcout
#define tcerr std::wcerr
-#ifdef WIN32
+#ifdef _WIN32
#define tstrncasecmp _wcsnicmp
#else
#define tstrncasecmp wcsncasecmp
-#endif // WIN32
+#endif // _WIN32
#ifndef T2A
#define T2A(src) W2A(src)
@@ -149,11 +149,11 @@
#define totlower tolower
#define tcout std::cout
#define tcerr std::cerr
-#ifdef WIN32
+#ifdef _WIN32
#define tstrncasecmp _strnicmp
#else
#define tstrncasecmp strncasecmp
-#endif // WIN32
+#endif // _WIN32
#ifndef T2A
#define T2A(src) src
@@ -174,7 +174,8 @@
#define ttol atol
#define itot itoa
#define tcscmp strcmp
-#endif // LOG4CXX_UNICODE
+#endif // LOG4CXX_UNICODE
+
#define _MinInc size_t(512)
#define _MaxInc size_t(100 * 1024)
1.2 +2 -1
logging-log4cxx/include/log4cxx/nt/outputdebugstringappender.h
Index: outputdebugstringappender.h
===================================================================
RCS file:
/home/cvs/logging-log4cxx/include/log4cxx/nt/outputdebugstringappender.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- outputdebugstringappender.h 11 Aug 2004 19:01:14 -0000 1.1
+++ outputdebugstringappender.h 26 Oct 2004 18:12:28 -0000 1.2
@@ -17,7 +17,8 @@
#ifndef _LOG4CXX_NT_OUTPUTDEBUGSTRING_APPENDER_HEADER_
#define _LOG4CXX_NT_OUTPUTDEBUGSTRING_APPENDER_HEADER_
-#include <log4cxx/appenderskeleton.h>
+#include <log4cxx/appenderskeleton.h>
+#include <windows.h>
namespace log4cxx
{
1.4 +33 -59
logging-log4cxx/include/log4cxx/spi/location/locationinfo.h
Index: locationinfo.h
===================================================================
RCS file:
/home/cvs/logging-log4cxx/include/log4cxx/spi/location/locationinfo.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- locationinfo.h 21 Oct 2004 04:53:44 -0000 1.3
+++ locationinfo.h 26 Oct 2004 18:12:28 -0000 1.4
@@ -15,9 +15,10 @@
*/
#ifndef _LOG4CXX_SPI_LOCATION_LOCATIONINFO_H
- #define _LOG4CXX_SPI_LOCATION_LOCATIONINFO_H
-
- #include <string>
+#define _LOG4CXX_SPI_LOCATION_LOCATIONINFO_H
+
+#include <log4cxx/portability.h>
+#include <string>
namespace log4cxx
{
@@ -30,7 +31,7 @@
*
* @remarks This class currently only used by the experimental (and
optional) log4cxx::stream class.
*/
- class LocationInfo
+ class LOG4CXX_EXPORT LocationInfo
{
public:
@@ -52,58 +53,29 @@
LocationInfo( const char * const fileName,
const char * const className,
const char * const methodName,
- int lineNumber )
- : fileName( fileName ),
- className( className ),
- methodName( methodName ),
- lineNumber( lineNumber )
- {
- }
+ int lineNumber);
/**
* Default constructor.
*/
- LocationInfo()
- : fileName(LocationInfo::NA),
- className(LocationInfo::NA),
- methodName(LocationInfo::NA),
- lineNumber(-1) {
- }
+ LocationInfo();
/**
* Copy constructor.
* @param src source location
*/
- LocationInfo( const LocationInfo & src )
- : fileName( src.fileName ),
- className( src.className ),
- methodName( src.methodName ),
- lineNumber( src.lineNumber )
- {
- }
+ LocationInfo( const LocationInfo & src );
/**
* Assignment operator.
* @param src source location
*/
- LocationInfo & operator = ( const LocationInfo & src )
- {
- fileName = src.fileName;
- className = src.className;
- methodName = src.methodName;
- lineNumber = src.lineNumber;
- return * this;
- }
+ LocationInfo & operator = ( const LocationInfo & src );
/**
* Resets location info to default state.
*/
- void clear() {
- fileName = NA;
- className = NA;
- methodName = NA;
- lineNumber = -1;
- }
+ void clear();
/** Return the class name of the call site. */
@@ -113,25 +85,16 @@
* Return the file name of the caller.
* @returns file name, may be null.
*/
- const char * getFileName() const
- {
- return fileName;
- }
+ const char * getFileName() const;
/**
* Returns the line number of the caller.
* @returns line number, -1 if not available.
*/
- int getLineNumber() const
- {
- return lineNumber;
- }
-
+ int getLineNumber() const;
+
/** Returns the method name of the caller. */
- const char * getMethodName() const
- {
- return methodName;
- }
+ const char * getMethodName() const;
/** Formatted representation of location */
const std::string getFullInfo() const;
@@ -153,7 +116,7 @@
};
- class LocationFlush : public LocationInfo {
+ class LOG4CXX_EXPORT LocationFlush : public LocationInfo {
public:
/**
* Constructor.
@@ -173,7 +136,7 @@
}
#if !defined(LOG4CXX_LOCATION)
- #if defined(_GCC_VER)
+ #if defined(__PRETTY_FUNCTION__)
#define LOG4CXX_LOCATION
::log4cxx::spi::location::LocationInfo(__FILE__, \
__PRETTY_FUNCTION__,
\
__func__,
\
@@ -183,7 +146,7 @@
__func__,
\
__LINE__)
#else
- #if defined(_MSC_VER)
+ #if defined(__FUNCSIG__)
#define LOG4CXX_LOCATION
::log4cxx::spi::location::LocationInfo(__FILE__, \
__FUNCSIG__,
\
__FUNCTION__,
\
@@ -192,16 +155,27 @@
__FUNCSIG__,
\
__FUNCTION__,
\
__LINE__)
- #else
- #define LOG4CXX_LOCATION
::log4cxx::spi::location::LocationInfo(__FILE__, \
+ #else
+ #if defined(__func__)
+ #define LOG4CXX_LOCATION
::log4cxx::spi::location::LocationInfo(__FILE__, \
::log4cxx::spi::location::LocationInfo::NA,
\
__func__,
\
__LINE__)
- #define LOG4CXX_LOCATION_FLUSH
::log4cxx::spi::location::LocationFlush(__FILE__, \
+ #define LOG4CXX_LOCATION_FLUSH
::log4cxx::spi::location::LocationFlush(__FILE__, \
::log4cxx::spi::location::LocationInfo::NA,
\
__func__,
\
- __LINE__)
- #endif
+ __LINE__)
+ #else
+ #define LOG4CXX_LOCATION
::log4cxx::spi::location::LocationInfo(__FILE__, \
+ ::log4cxx::spi::location::LocationInfo::NA,
\
+ ::log4cxx::spi::location::LocationInfo::NA,
\
+ __LINE__)
+ #define LOG4CXX_LOCATION_FLUSH
::log4cxx::spi::location::LocationFlush(__FILE__, \
+ ::log4cxx::spi::location::LocationInfo::NA,
\
+ ::log4cxx::spi::location::LocationInfo::NA,
\
+ __LINE__)
+ #endif
+ #endif
#endif
#endif
1.9 +3 -3 logging-log4cxx/src/condition.cpp
Index: condition.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/src/condition.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- condition.cpp 13 Aug 2004 12:27:47 -0000 1.8
+++ condition.cpp 26 Oct 2004 18:12:28 -0000 1.9
@@ -69,7 +69,7 @@
// updated by another thread.
// if (waiters != 0) (atomic comparison)
-# if LOG4CXX_LOG4CXX_HAVE_OLD_WIN32_INTERLOCKS // MSDEV 6
+# if LOG4CXX_HAVE_OLD_WIN32_INTERLOCKS // MSDEV 6
if ((long)InterlockedCompareExchange((void**)&waiters, 0, 0) != 0)
# else
if ((long)InterlockedCompareExchange(&waiters, 0, 0) != 0)
@@ -86,7 +86,7 @@
::pthread_cond_wait(&condition, &mutex.mutex);
#elif defined(LOG4CXX_HAVE_MS_THREAD)
-#if LOG4CXX_LOG4CXX_HAVE_OLD_WIN32_INTERLOCKS // MSDEV 6
+#if LOG4CXX_HAVE_OLD_WIN32_INTERLOCKS // MSDEV 6
::InterlockedIncrement((long *)&waiters);
#else
::InterlockedIncrement(&waiters);
@@ -98,7 +98,7 @@
throw ConditionException();
}
-#if LOG4CXX_LOG4CXX_HAVE_OLD_WIN32_INTERLOCKS // MSDEV 6
+#if LOG4CXX_HAVE_OLD_WIN32_INTERLOCKS // MSDEV 6
long oldWaiters = ::InterlockedDecrement((long*)&waiters);
#else
long oldWaiters = ::InterlockedDecrement(&waiters);
1.9 +4 -2 logging-log4cxx/src/criticalsection.cpp
Index: criticalsection.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/src/criticalsection.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- criticalsection.cpp 18 Aug 2004 21:04:56 -0000 1.8
+++ criticalsection.cpp 26 Oct 2004 18:12:28 -0000 1.9
@@ -77,7 +77,8 @@
#endif
impl->owningThread = Thread::getCurrentThreadId();
}
-
+
+#if 0
bool CriticalSection::try_lock()
{
#ifdef LOG4CXX_HAVE_PTHREAD
@@ -88,7 +89,8 @@
#elif defined(LOG4CXX_HAVE_MS_THREAD)
#error "try_lock is not implemented for msthread"
#endif
-}
+}
+#endif
void CriticalSection::unlock()
{
1.17 +5 -3 logging-log4cxx/src/dateformat.cpp
Index: dateformat.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/src/dateformat.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- dateformat.cpp 25 Oct 2004 04:44:03 -0000 1.16
+++ dateformat.cpp 26 Oct 2004 18:12:28 -0000 1.17
@@ -95,9 +95,11 @@
size_t pos = result.find(_T("%Q"));
if (pos != String::npos)
{
- os << result.substr(0, pos)
- << std::setw(3) << std::setfill(_T('0')) <<
(long)(timeMillis % 1000)
- << result.substr(pos + 2);
+ os << result.substr(0, pos);
+ os.width(3);
+ os.fill(_T('0'));
+ os << (long)(timeMillis % 1000);
+ os << result.substr(pos + 2);
}
else
{
1.6 +16 -4 logging-log4cxx/src/event.cpp
Index: event.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/src/event.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- event.cpp 25 Oct 2004 04:44:03 -0000 1.5
+++ event.cpp 26 Oct 2004 18:12:28 -0000 1.6
@@ -89,7 +89,18 @@
}
};
- class CannotWaitOnConditionException : public EventException
+ class CannotResetEventException : public EventException
+ {
+ public:
+ CannotResetEventException() {
+ }
+ const char* what() const throw() {
+ return "Cannot reset event";
+ }
+ };
+
+
+ class CannotWaitOnConditionException : public EventException
{
public:
CannotWaitOnConditionException() {
@@ -114,10 +125,11 @@
Event::Event(bool manualReset, bool initialState)
-: condition(), mutex()
#ifdef LOG4CXX_HAVE_PTHREAD
- , manualReset(manualReset), state(initialState)
-#endif
+: condition(), mutex() , manualReset(manualReset), state(initialState)
+#elif defined(LOG4CXX_HAVE_MS_THREAD)
+: event(0)
+#endif
{
#ifdef LOG4CXX_HAVE_PTHREAD
pthread_cond_init(&condition, 0);
1.3 +85 -0 logging-log4cxx/src/locationinfo.cpp
Index: locationinfo.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/src/locationinfo.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- locationinfo.cpp 21 Oct 2004 04:53:44 -0000 1.2
+++ locationinfo.cpp 26 Oct 2004 18:12:28 -0000 1.3
@@ -24,6 +24,91 @@
constant is <b>?</b>. */
const char* const LocationInfo::NA = "?";
+/**
+* Constructor.
+* @remarks Used by LOG4CXX_LOCATION to generate
+* location info for current code site
+*/
+ LocationInfo::LocationInfo( const char * const fileName,
+ const char * const className,
+ const char * const methodName,
+ int lineNumber )
+ : fileName( fileName ),
+ className( className ),
+ methodName( methodName ),
+ lineNumber( lineNumber )
+ {
+}
+
+/**
+* Default constructor.
+*/
+ LocationInfo::LocationInfo()
+ : fileName(LocationInfo::NA),
+ className(LocationInfo::NA),
+ methodName(LocationInfo::NA),
+ lineNumber(-1) {
+}
+
+/**
+* Copy constructor.
+* @param src source location
+*/
+ LocationInfo::LocationInfo( const LocationInfo & src )
+ : fileName( src.fileName ),
+ className( src.className ),
+ methodName( src.methodName ),
+ lineNumber( src.lineNumber )
+ {
+}
+
+/**
+* Assignment operator.
+* @param src source location
+*/
+ LocationInfo & LocationInfo::operator = ( const LocationInfo & src )
+{
+ fileName = src.fileName;
+ className = src.className;
+ methodName = src.methodName;
+ lineNumber = src.lineNumber;
+ return * this;
+}
+
+/**
+ * Resets location info to default state.
+ */
+ void LocationInfo::clear() {
+ fileName = NA;
+ className = NA;
+ methodName = NA;
+ lineNumber = -1;
+}
+
+
+/**
+ * Return the file name of the caller.
+ * @returns file name, may be null.
+ */
+ const char * LocationInfo::getFileName() const
+{
+ return fileName;
+}
+
+/**
+ * Returns the line number of the caller.
+ * @returns line number, -1 if not available.
+ */
+ int LocationInfo::getLineNumber() const
+{
+ return lineNumber;
+}
+
+/** Returns the method name of the caller. */
+ const char * LocationInfo::getMethodName() const
+{
+ return methodName;
+}
const std::string LocationInfo::getClassName() const {
1.10 +14 -1 logging-log4cxx/src/msxml.cpp
Index: msxml.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/src/msxml.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- msxml.cpp 14 Oct 2004 17:46:44 -0000 1.9
+++ msxml.cpp 26 Oct 2004 18:12:28 -0000 1.10
@@ -62,6 +62,19 @@
: document(document), mustCallCoUninitialize(false)
{
}
+
+namespace log4cxx {
+ namespace helpers {
+ class CoInitializeException : Exception {
+ public:
+ CoInitializeException() {}
+ const char* what() const throw() {
+ return "Cannot initialize COM";
+ }
+ };
+ }
+}
+
MsXMLDOMDocument::MsXMLDOMDocument() : mustCallCoUninitialize(false)
{
@@ -74,7 +87,7 @@
break;
default:
- throw RuntimeException(_T("Cannot Initialize COM"));
+ throw CoInitializeException();
}
}
else
1.8 +2 -1 logging-log4cxx/src/stringtokenizer.cpp
Index: stringtokenizer.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/src/stringtokenizer.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- stringtokenizer.cpp 25 Oct 2004 17:05:09 -0000 1.7
+++ stringtokenizer.cpp 26 Oct 2004 18:12:28 -0000 1.8
@@ -46,5 +46,6 @@
return src.substr(nextPos, pos - nextPos);
}
}
- throw NoSuchElementException();
+ throw NoSuchElementException();
+ return String();
}
1.18 +3 -3 logging-log4cxx/src/thread.cpp
Index: thread.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/src/thread.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- thread.cpp 25 Oct 2004 04:44:03 -0000 1.17
+++ thread.cpp 26 Oct 2004 18:12:28 -0000 1.18
@@ -120,7 +120,7 @@
(void *)::CreateThread(NULL, 0, threadProc, this, 0, &threadId);
if (impl->thread == 0)
{
- throw UnableToStartThreadException();
+ throw ThreadException();
}
#endif
}
@@ -224,7 +224,7 @@
sparc_atomic_add_32(val, 1);
return *val;
#elif defined(LOG4CXX_HAVE_MS_THREAD)
-#if LOG4CXX_LOG4CXX_HAVE_OLD_WIN32_INTERLOCKS // MSDEV 6
+#if LOG4CXX_HAVE_OLD_WIN32_INTERLOCKS // MSDEV 6
return ::InterlockedIncrement((long *)val);
#else
return ::InterlockedIncrement(val);
@@ -250,7 +250,7 @@
sparc_atomic_add_32(val, -1);
return *val;
#elif defined(LOG4CXX_HAVE_MS_THREAD)
-#if LOG4CXX_LOG4CXX_HAVE_OLD_WIN32_INTERLOCKS // MSDEV 6
+#if LOG4CXX_HAVE_OLD_WIN32_INTERLOCKS // MSDEV 6
return ::InterlockedDecrement((long *)val);
#else
return ::InterlockedDecrement(val);
1.9 +1 -4 logging-log4cxx/src/threadspecificdata.cpp
Index: threadspecificdata.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/src/threadspecificdata.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- threadspecificdata.cpp 18 Aug 2004 21:04:56 -0000 1.8
+++ threadspecificdata.cpp 26 Oct 2004 18:12:28 -0000 1.9
@@ -51,8 +51,7 @@
#ifdef LOG4CXX_HAVE_PTHREAD
pthread_key_create(&impl->key, cleanup);
#elif defined(LOG4CXX_HAVE_MS_THREAD)
-// impl->key = (void *)TlsAlloc();
-#error "Not implemented"
+ impl->key = (void *)TlsAlloc();
#endif
}
@@ -87,5 +86,3 @@
#endif
}
-
-ThreadSpecificData_ptr<int> test;
1.3 +2 -0 logging-log4cxx/tests/src/.cvsignore
Index: .cvsignore
===================================================================
RCS file: /home/cvs/logging-log4cxx/tests/src/.cvsignore,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- .cvsignore 21 Oct 2004 04:53:45 -0000 1.2
+++ .cvsignore 26 Oct 2004 18:12:28 -0000 1.3
@@ -1,6 +1,8 @@
Makefile
Makefile.in
shortsocketserver
+shortsocketserver.exe
+shortsocketserver.pdb
.deps
.libs
history.xml
1.2 +22 -2 logging-log4cxx/tests/src/streamtestcase.cpp
Index: streamtestcase.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/tests/src/streamtestcase.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- streamtestcase.cpp 25 Oct 2004 04:37:16 -0000 1.1
+++ streamtestcase.cpp 26 Oct 2004 18:12:28 -0000 1.2
@@ -60,7 +60,9 @@
CPPUNIT_TEST(testPrecision);
// CPPUNIT_TEST(testWidth);
CPPUNIT_TEST(testGetStream);
- CPPUNIT_TEST(testGetStreamDebug);
+ CPPUNIT_TEST(testGetStreamDebug);
+ CPPUNIT_TEST(testInsertLevel);
+ CPPUNIT_TEST(testInsertLocation);
CPPUNIT_TEST_SUITE_END();
VectorAppenderPtr vectorAppender;
@@ -178,7 +180,25 @@
CPPUNIT_ASSERT_EQUAL((size_t) 0,
vectorAppender->getVector().size());
}
-
+
+ void testInsertLevel() {
+ LoggerPtr logger(Logger::getLogger("StreamTestCase.insertLevel"));
+ logger->setLevel(log4cxx::Level::INFO);
+ log4cxx::logstream stream(logger, log4cxx::Level::DEBUG);
+ stream
+ << log4cxx::Level::WARN
+ << "This message must get through"
+ << LOG4CXX_ENDMSG;
+ CPPUNIT_ASSERT_EQUAL((size_t) 1,
vectorAppender->getVector().size());
+ }
+
+ void testInsertLocation() {
+ LoggerPtr logger(Logger::getRootLogger());
+ log4cxx::logstream stream(logger, log4cxx::Level::DEBUG);
+ stream
+ << LOG4CXX_LOCATION;
+ }
+
};
CPPUNIT_TEST_SUITE_REGISTRATION(StreamTestCase);
1.5 +1 -1 logging-log4cxx/tests/src/net/socketservertestcase.cpp
Index: socketservertestcase.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/tests/src/net/socketservertestcase.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- socketservertestcase.cpp 14 Oct 2004 17:50:53 -0000 1.4
+++ socketservertestcase.cpp 26 Oct 2004 18:12:28 -0000 1.5
@@ -95,7 +95,7 @@
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
ZeroMemory( &pi, sizeof(pi) );
- String commandLine(_T("shortsocketserver 8
input/socketServer"));
+ String commandLine(_T("src\\shortsocketserver 8
input/socketServer"));
BOOL bResult = ::CreateProcess(NULL,
(LPTSTR)commandLine.c_str(), NULL, NULL,
TRUE, 0, NULL, NULL, &si, &pi);
1.2 +11 -1 logging-log4cxx/tests/src/util/filenamefilter.cpp
Index: filenamefilter.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/tests/src/util/filenamefilter.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- filenamefilter.cpp 14 Oct 2004 17:50:53 -0000 1.1
+++ filenamefilter.cpp 26 Oct 2004 18:12:29 -0000 1.2
@@ -22,7 +22,17 @@
FilenameFilter::FilenameFilter(const char* actual, const char* expected)
: pattern(" "),
replacement(" ") {
- pattern += actual;
+ pattern += actual;
+ size_t backslash = pattern.rfind('\\', pattern.length() - 1);
+ while (backslash != std::string::npos) {
+ pattern.replace(backslash, 1, "\\\\", 2);
+ if (backslash == 0) {
+ backslash = std::string::npos;
+ } else {
+ backslash = pattern.rfind('\\', backslash - 1);
+ }
+ }
+
replacement += expected;
}
1.2 +12 -2 logging-log4cxx/tests/src/util/xmlfilenamefilter.cpp
Index: xmlfilenamefilter.cpp
===================================================================
RCS file: /home/cvs/logging-log4cxx/tests/src/util/xmlfilenamefilter.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- xmlfilenamefilter.cpp 14 Oct 2004 17:50:53 -0000 1.1
+++ xmlfilenamefilter.cpp 26 Oct 2004 18:12:29 -0000 1.2
@@ -21,8 +21,18 @@
XMLFilenameFilter::XMLFilenameFilter(const char* actual, const char*
expected)
: pattern(" file=\""),
- replacement(" file=\"") {
- pattern += actual;
+ replacement(" file=\"") {
+ std::string filename(actual);
+ size_t backslash = filename.rfind('\\', filename.length() - 1);
+ while (backslash != std::string::npos) {
+ filename.replace(backslash, 1, "\\\\", 2);
+ if (backslash == 0) {
+ backslash = std::string::npos;
+ } else {
+ backslash = filename.rfind('\\', backslash - 1);
+ }
+ }
+ pattern += filename;
pattern += "\"";
replacement += expected;