From 3d403f2af2e5b7d26254d45590764f279450fab6 Mon Sep 17 00:00:00 2001 From: Thorsten Behrens Date: Fri, 13 Feb 2015 17:02:58 +0100 Subject: Related: tdf#63690 - remove rtl_logfile This was unused since the earlier cleanup. Change-Id: Ia56641c4242037a0ce501e43939b8dc862499f0e --- android/Bootstrap/Makefile.shared | 1 - android/experimental/desktop/Makefile | 1 - desktop/source/offacc/acceptor.hxx | 1 - framework/inc/pch/precompiled_fwk.hxx | 1 - .../moduleacceleratorconfiguration.cxx | 1 - include/rtl/logfile.h | 131 ------------ include/rtl/logfile.hxx | 205 ------------------ odk/Package_odk_headers.mk | 2 - sal/Library_sal.mk | 1 - sal/inc/pch/precompiled_sal.hxx | 1 - sal/osl/w32/module.cxx | 1 - sal/qa/rtl/logfile/rtl_logfile.cxx | 233 --------------------- sal/rtl/logfile.cxx | 227 -------------------- sal/util/sal.map | 3 - solenv/gbuild/gbuild.help.txt | 4 - sw/inc/pch/precompiled_sw.hxx | 1 - sw/source/core/doc/DocumentTimerManager.cxx | 1 - vcl/inc/pch/precompiled_vcl.hxx | 1 - vcl/source/app/svmain.cxx | 2 - vcl/win/source/gdi/salgdi3.cxx | 1 - 20 files changed, 819 deletions(-) delete mode 100644 include/rtl/logfile.h delete mode 100644 include/rtl/logfile.hxx delete mode 100644 sal/qa/rtl/logfile/rtl_logfile.cxx delete mode 100644 sal/rtl/logfile.cxx diff --git a/android/Bootstrap/Makefile.shared b/android/Bootstrap/Makefile.shared index 12b4774042b1..a215d44e423e 100644 --- a/android/Bootstrap/Makefile.shared +++ b/android/Bootstrap/Makefile.shared @@ -158,7 +158,6 @@ copy-stuff: echo 'Logo=1' >> assets/unpack/program/sofficerc echo 'NativeProgress=1' >> assets/unpack/program/sofficerc echo 'URE_BOOTSTRAP=file:///assets/program/fundamentalrc' >> assets/unpack/program/sofficerc -# echo 'RTL_LOGFILE=file:///dev/log/main' >> assets/unpack/program/sofficerc echo 'HOME=$$APP_DATA_DIR/cache' >> assets/unpack/program/sofficerc echo 'OSL_SOCKET_PATH=$$APP_DATA_DIR/cache' >> assets/unpack/program/sofficerc # diff --git a/android/experimental/desktop/Makefile b/android/experimental/desktop/Makefile index 3a7f6ba952f1..95167371404e 100644 --- a/android/experimental/desktop/Makefile +++ b/android/experimental/desktop/Makefile @@ -41,7 +41,6 @@ copy-stuff-desktop: echo "Logo=1" >> assets/program/lofficerc echo "NativeProgress=1" >> assets/program/lofficerc echo "URE_BOOTSTRAP=file:///assets/program/fundamentalrc" >> assets/program/lofficerc -# echo "RTL_LOGFILE=file:///dev/log/main" >> assets/program/lofficerc echo "HOME=$(APP_DATA_PATH)/files" >> assets/program/lofficerc echo "OSL_SOCKET_PATH=$(APP_DATA_PATH)/files" >> assets/program/lofficerc # - this looks useful but breaks more than it fixes ... diff --git a/desktop/source/offacc/acceptor.hxx b/desktop/source/offacc/acceptor.hxx index e19c7487b82f..a7c35ae761fe 100644 --- a/desktop/source/offacc/acceptor.hxx +++ b/desktop/source/offacc/acceptor.hxx @@ -35,7 +35,6 @@ #include #include #include -#include #include #include diff --git a/framework/inc/pch/precompiled_fwk.hxx b/framework/inc/pch/precompiled_fwk.hxx index 98d91b4f1b14..22f6ddd5b584 100644 --- a/framework/inc/pch/precompiled_fwk.hxx +++ b/framework/inc/pch/precompiled_fwk.hxx @@ -316,7 +316,6 @@ #include #include #include -#include #include #include #include diff --git a/framework/source/accelerators/moduleacceleratorconfiguration.cxx b/framework/source/accelerators/moduleacceleratorconfiguration.cxx index 9a37b9b5f33e..3d42c8e0be71 100644 --- a/framework/source/accelerators/moduleacceleratorconfiguration.cxx +++ b/framework/source/accelerators/moduleacceleratorconfiguration.cxx @@ -36,7 +36,6 @@ #include #include -#include using namespace framework; diff --git a/include/rtl/logfile.h b/include/rtl/logfile.h deleted file mode 100644 index f9bd101304db..000000000000 --- a/include/rtl/logfile.h +++ /dev/null @@ -1,131 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you 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 . - */ -#ifndef INCLUDED_RTL_LOGFILE_H -#define INCLUDED_RTL_LOGFILE_H - -#include - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - - -/** This function allows to log arbitrary messages even in a product-environment. - - The logfile is created on first access and closed, when the sal-library gets unloaded. - The file is line buffered. A log file is not created if no log messages are - written. - - The first time, rtl_logfile_trace is called, it checks for the bootstrap variable - RTL_LOGFILE. If the variable is not empty, it creates a file with the name - $(RTL_LOGFILE)_$(PID).log, where $(PID) is the process id of the running process. - - @param pszFormat A format string with fprintf-syntax - @param ... An arbitrary number of arguments for fprintf, matching the - format string. -*/ -SAL_DLLPUBLIC void SAL_CALL rtl_logfile_trace( const sal_Char* pszFormat, ... ); - -/** Like rtl_logfile_trace, but prefixing every log entry with the current time - and thread ID. - - @param format - a format string with fprintf-like syntax - - @param ... - an arbitrary number of arguments for fprintf, matching the given format - string - - @since UDK 3.2.0 -*/ -SAL_DLLPUBLIC void SAL_CALL rtl_logfile_longTrace(char const * format, ...); - -/** Return if a log file is written. - - @return true if a log file is written - - @since UDK 3.2.11 -*/ -SAL_DLLPUBLIC sal_Bool SAL_CALL rtl_logfile_hasLogFile( void ); - -#ifdef __cplusplus -} -#endif - -#ifdef TIMELOG -#define RTL_LOGFILE_TRACE( string ) \ - rtl_logfile_longTrace( "| : %s\n", string ) -#define RTL_LOGFILE_TRACE1( frmt, arg1 ) \ - rtl_logfile_longTrace( "| : " ); \ - rtl_logfile_trace( frmt, arg1 ); \ - rtl_logfile_trace( "\n" ) - -#define RTL_LOGFILE_TRACE2( frmt, arg1 , arg2 ) \ - rtl_logfile_longTrace( "| : " ); \ - rtl_logfile_trace( frmt, arg1 , arg2 ); \ - rtl_logfile_trace( "\n" ) -#define RTL_LOGFILE_TRACE3( frmt, arg1 , arg2 , arg3 ) \ - rtl_logfile_longTrace( "| : " ); \ - rtl_logfile_trace( frmt, arg1 , arg2 , arg3 ); \ - rtl_logfile_trace( "\n" ) - -// Now the macros with project and author arguments. The strings -// are formatted in a way, so that the log file can be parsed by -// post processing scripts. -#define RTL_LOGFILE_TRACE_AUTHOR( project, author, string ) \ - rtl_logfile_longTrace( "| %s (%s) : %s\n", \ - project,\ - author,\ - string ) -#define RTL_LOGFILE_TRACE_AUTHOR1( project, author, frmt, arg1 ) \ - rtl_logfile_longTrace( "| %s (%s) : ", \ - project,\ - author );\ - rtl_logfile_trace( frmt, arg1 ); \ - rtl_logfile_trace( "\n" ) - -#define RTL_LOGFILE_TRACE_AUTHOR2( project, author, frmt, arg1 , arg2 ) \ - rtl_logfile_longTrace( "| %s (%s) : ", \ - project,\ - author ); \ - rtl_logfile_trace( frmt, arg1 , arg2 ); \ - rtl_logfile_trace( "\n" ) -#define RTL_LOGFILE_TRACE_AUTHOR3( project, author, frmt, arg1 , arg2 , arg3 ) \ - rtl_logfile_longTrace( "| %s (%s) : ", \ - project,\ - author ); \ - rtl_logfile_trace( frmt, arg1 , arg2 , arg3 ); \ - rtl_logfile_trace( "\n" ) -#else -#define RTL_LOGFILE_TRACE( string ) ((void)0) -#define RTL_LOGFILE_TRACE1( frmt, arg1 ) ((void)0) -#define RTL_LOGFILE_TRACE2( frmt, arg1 , arg2 ) ((void)0) -#define RTL_LOGFILE_TRACE3( frmt, arg1 , arg2 , arg3 ) ((void)0) - -#define RTL_LOGFILE_TRACE_AUTHOR( project, author, string ) ((void)0) -#define RTL_LOGFILE_TRACE_AUTHOR1( project, author, frmt, arg1 ) ((void)0) -#define RTL_LOGFILE_TRACE_AUTHOR2( project, author, frmt, arg1 , arg2 ) ((void)0) -#define RTL_LOGFILE_TRACE_AUTHOR3( project, author, frmt, arg1 , arg2 , arg3 ) ((void)0) -#endif // TIMELOG -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/rtl/logfile.hxx b/include/rtl/logfile.hxx deleted file mode 100644 index f511819d311e..000000000000 --- a/include/rtl/logfile.hxx +++ /dev/null @@ -1,205 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you 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 . - */ -#ifndef INCLUDED_RTL_LOGFILE_HXX -#define INCLUDED_RTL_LOGFILE_HXX - -#include -#include -#include - -namespace rtl -{ -/** -@brief The intended use for class Logfile is to write time stamp information - for profiling purposes. - - Profiling output should only be generated for a special product version of OpenOffice - which is compiled with a defined preprocessor symbol 'TIMELOG'. - Therefore we have provided a set of macros that uses the class Logfile only if - this symbol is defined. If the macros are not sufficient, i.e. you need more - then three arguments for a printf style message, then you have to insert an - \#ifdef TIMELOG/\#endif brace yourself. - - Additionally the environment variable RTL_LOGFILE has to be defined in order to generate - logging information. If the variable is not empty, it creates a file with the name - $(RTL_LOGFILE)_$(PID).log, where $(PID) is the process id of the running process. - It can be used as a run time switch for enabling or disabling the logging. - Note that this variable is evaluated only once at the first attempt to write a message. - - The class LogFile collects runtime data within its constructor and destructor. It can be - used for timing whole functions. - If you want to write timing data without context you can use the RTL_LOGFILE_TRACE-macros - which are defined inside . - - The class LogFile should not be used directly, instead use the RTL_LOGFILE_CONTEXT/ - RTL_LOGFILE_TRACE-macros. - - Macro usage: - ------------ - RTL_LOGFILE_CONTEXT( instance, name ); - This macro creates an instance of class LogFile with the name "instance" and writes the current time, - thread id and "name" to the log file. - - Example: RTL_LOGFILE_CONTEXT( aLog, "Timing for foo-method" ); - - RTL_LOGFILE_CONTEXT_TRACE( instance, message ); - RTL_LOGFILE_CONTEXT_TRACEn( instance, frmt, arg1, .., arg3 ); - These macros can be used to log information in a "instance" context. The "instance" object - is used to log message information. All macros with "frmt" uses printf notation to log timing infos. - - Example: RTL_LOGFILE_CONTEXT_TRACE( aLog, "Now we call an expensive function" ); - RTL_LOGFIlE_CONTEXT_TRACE1( aLog, "Config entries read: %u", (unsigned short)i ); - - RTL_LOGFILE_TRACE( string ); - RTL_LOGFILE_TRACEn( frmt, arg1, .., arg3 ); - These macros can be used to log information outside a context. The macro directly calls - rtl_logfile_trace to write the info to the log file. All macros with "frmt" uses printf - notation to log timing infos. - - Example: RTL_LOGFILE_TRACE( "Timing for loading a file" ); - RTL_LOGFILE_TRACE1( aLog, "Timing for loading file: %s", aFileName ); - - The lines written to the log file consist of the following space separated elements: - 1. The time relative to the start of the global timer in milliseconds. The times is - started typically for the first logged line. - 2. Thread id. It's absolut value is probably of less interest than providing a way to - distinguish different threads. - 3. a. An opening or closing curly brace indicating the start or end of a scope. - 4a. Function name or general scope identifier. - b. A vertical line indicating an arbitrary message. - 4b optional function name or general scope identifier. - 5b A colon followed by a space and a free form message terminated by a newline. - - There is a second version of creating a context. RTL_LOGFILE_CONTEXT_AUTHOR takes - two more arguments, the name of the project and the author's sign who is responsible - for the code in which the macro is used. -*/ - class Logfile - { - public: - inline Logfile( const sal_Char *name ); - /** Create a log file context - - Create a log file context where the message field consists of a project - name, the author's shortcut, and the actual message. These three strings - are written in a format that is understood by script that later parses the - log file and that so can extract the three strings. - @param project Short name of the project, like sw for writer or sc for calc. - @param author The sign of the person responsible for the code. - @param name The actual message, typically a method name. - */ - inline Logfile( const sal_Char *project, const sal_Char *author, const sal_Char *name ); - inline ~Logfile(); - inline const sal_Char *getName(); - private: - ::rtl::OString m_sName; - }; - - inline Logfile::Logfile( const sal_Char *name ) - : m_sName( name ) - { - rtl_logfile_longTrace( "{ %s\n", name ); - } - - inline Logfile::Logfile( const sal_Char *project, const sal_Char *author, const sal_Char *name ) - : m_sName( project) - { - m_sName += " ("; - m_sName += author; - m_sName += ") "; - m_sName += name; - rtl_logfile_longTrace( "{ %s\n", m_sName.pData->buffer ); - } - - inline Logfile::~Logfile() - { - rtl_logfile_longTrace( "} %s\n", m_sName.pData->buffer ); - } - - inline const sal_Char * Logfile::getName() - { - return m_sName.getStr(); - } -} - -#ifdef TIMELOG -#define RTL_LOGFILE_CONTEXT( instance, name ) ::rtl::Logfile instance( name ) -#define RTL_LOGFILE_CONTEXT_AUTHOR( instance, project, author, name ) ::rtl::Logfile instance(project, author, name ) -#define RTL_LOGFILE_CONTEXT_TRACE( instance, message ) \ - rtl_logfile_longTrace( "| %s : %s\n", \ - instance.getName(), \ - message ) -#define RTL_LOGFILE_CONTEXT_TRACE1( instance , frmt, arg1 ) \ - rtl_logfile_longTrace( "| %s : ", \ - instance.getName() ); \ - rtl_logfile_trace( frmt , arg1 ); \ - rtl_logfile_trace( "\n" ) -#define RTL_LOGFILE_CONTEXT_TRACE2( instance , frmt, arg1 , arg2 ) \ - rtl_logfile_longTrace( "| %s : ", \ - instance.getName() ); \ - rtl_logfile_trace( frmt , arg1 , arg2 ); \ - rtl_logfile_trace( "\n" ) -#define RTL_LOGFILE_CONTEXT_TRACE3( instance , frmt, arg1 , arg2 , arg3 ) \ - rtl_logfile_longTrace( "| %s : ", \ - instance.getName() ); \ - rtl_logfile_trace( frmt , arg1 , arg2 , arg3 ); \ - rtl_logfile_trace( "\n" ) - -#else - -#define RTL_LOGFILE_FORWARD_VIA_SAL_LOG(area, message) \ - SAL_DETAIL_INFO_IF_FORMAT(SAL_DETAIL_ENABLE_LOG_INFO, area, "%s", message) - -#define RTL_LOGFILE_CONTEXT( instance, name ) RTL_LOGFILE_FORWARD_VIA_SAL_LOG("logfile", name) -#define RTL_LOGFILE_CONTEXT_AUTHOR( instance, project, author, name ) RTL_LOGFILE_FORWARD_VIA_SAL_LOG(project ".logfile", name) -#define RTL_LOGFILE_CONTEXT_TRACE( instance, message ) RTL_LOGFILE_FORWARD_VIA_SAL_LOG("logfile", message) -#define RTL_LOGFILE_CONTEXT_TRACE1( instance, frmt, arg1 ) ((void)arg1,(void)0) -#define RTL_LOGFILE_CONTEXT_TRACE2( instance, frmt, arg1, arg2 ) ((void)arg1,(void)arg2,(void)0) -#define RTL_LOGFILE_CONTEXT_TRACE3( instance, frmt, arg1, arg2 , arg3 ) ((void)arg1,(void)arg2,(void)arg3,(void)0) -#endif - -// Normal RTL_LOGFILE_* entries will not make it into release versions, -// TIMELOG is disabled a few versions prior relase build. - -// We need some logs also in these builds, eg. for making performance regression tests. - -// POLICY: Don't use RTL_LOGFILE_PRODUCT_* for your personal logging information. -// Be aware that these logs make it into the product shipped to customers. -// If you have good reasons for doing this, please contact product management. - -#define RTL_LOGFILE_PRODUCT_TRACE( string ) \ - rtl_logfile_longTrace( "| : %s\n", string ) -#define RTL_LOGFILE_PRODUCT_TRACE1( frmt, arg1 ) \ - rtl_logfile_longTrace( "| : " ); \ - rtl_logfile_trace( frmt, arg1 ); \ - rtl_logfile_trace( "\n" ) -#define RTL_LOGFILE_PRODUCT_CONTEXT( instance, name ) \ - ::rtl::Logfile instance( name ) -#define RTL_LOGFILE_PRODUCT_CONTEXT_TRACE1( instance, frmt, arg1 ) \ - rtl_logfile_longTrace( "| %s : ", \ - instance.getName() ); \ - rtl_logfile_trace( frmt, arg1 ); \ - rtl_logfile_trace( "\n" ) -#define RTL_LOGFILE_HASLOGFILE() \ - rtl_logfile_hasLogFile() - - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/odk/Package_odk_headers.mk b/odk/Package_odk_headers.mk index 4618fcc34011..4b7590d1d66c 100644 --- a/odk/Package_odk_headers.mk +++ b/odk/Package_odk_headers.mk @@ -126,8 +126,6 @@ $(eval $(call gb_Package_add_files_with_dir,odk_headers,$(SDKDIRNAME)/include,\ rtl/digest.h \ rtl/instance.hxx \ rtl/locale.h \ - rtl/logfile.h \ - rtl/logfile.hxx \ rtl/malformeduriexception.hxx \ rtl/math.h \ rtl/math.hxx \ diff --git a/sal/Library_sal.mk b/sal/Library_sal.mk index 833ba6d92e0d..12b66dd76bea 100644 --- a/sal/Library_sal.mk +++ b/sal/Library_sal.mk @@ -99,7 +99,6 @@ $(eval $(call gb_Library_add_exception_objects,sal,\ sal/rtl/digest \ sal/rtl/hash \ sal/rtl/locale \ - sal/rtl/logfile \ sal/rtl/math \ sal/rtl/random \ sal/rtl/rtl_process \ diff --git a/sal/inc/pch/precompiled_sal.hxx b/sal/inc/pch/precompiled_sal.hxx index 1ac777dcf076..4e93245df8d7 100644 --- a/sal/inc/pch/precompiled_sal.hxx +++ b/sal/inc/pch/precompiled_sal.hxx @@ -90,7 +90,6 @@ #include #include #include -#include #include #include #include diff --git a/sal/osl/w32/module.cxx b/sal/osl/w32/module.cxx index 86a8c4be0816..ac4e21128cce 100644 --- a/sal/osl/w32/module.cxx +++ b/sal/osl/w32/module.cxx @@ -27,7 +27,6 @@ #include #include #include -#include #include /* diff --git a/sal/qa/rtl/logfile/rtl_logfile.cxx b/sal/qa/rtl/logfile/rtl_logfile.cxx deleted file mode 100644 index 374f9c3ca48b..000000000000 --- a/sal/qa/rtl/logfile/rtl_logfile.cxx +++ /dev/null @@ -1,233 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you 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 . - */ - -#include -#include -#include - -#if defined(UNX) -# include -#endif - -#include - -#include -#if ( defined WNT ) // Windows -#include -#endif - -#include -#include -#include -#include - -using namespace ::osl; - -inline void printUString( const ::rtl::OUString & str, const sal_Char * msg = "" ) -{ - - if (strlen(msg) > 0) - { - printf("%s: ", msg ); - } - rtl::OString aString; - aString = ::rtl::OUStringToOString( str, RTL_TEXTENCODING_ASCII_US ); - printf("%s\n", (char *)aString.getStr( ) ); -} - -/** get the absolute source file URL "file:///.../sal/qa/rtl/logfile/" - */ - -inline ::rtl::OUString getTempPath( void ) -{ -#ifdef UNX - rtl::OUString suDirURL( "file:///tmp/" ); -#else /* Windows */ - rtl::OUString suDirURL( "file:///c:/temp/" ); -#endif - return suDirURL; -} - -/** if the file exist - */ -bool t_fileExist(rtl::OUString const& _sFilename) -{ - ::osl::FileBase::RC nError1; - ::osl::File aTestFile( _sFilename ); - nError1 = aTestFile.open ( osl_File_OpenFlag_Read ); - if ( ( ::osl::FileBase::E_NOENT != nError1 ) && ( ::osl::FileBase::E_ACCES != nError1 ) ) - { - aTestFile.close( ); - return true; - } - return false; -} -/** get Current PID. -*/ -inline ::rtl::OUString getCurrentPID( ) -{ - //~ Get current PID and turn it into OUString; - int nPID = 0; -#ifdef WNT - nPID = GetCurrentProcessId(); -#else - nPID = getpid(); -#endif - return ( ::rtl::OUString::valueOf( ( long )nPID ) ); -} - -/* - * LLA: - * check if logfile is create - * be careful with relative logfiles they will create near the source, maybe it's no write access to it. - * use absolute path to logfile instead. - */ -namespace rtl_logfile -{ - class logfile : public CppUnit::TestFixture - { - public: - - //directly call rtl_logfile_trace - void logfile_001() - { -#ifdef SOLARIS - putenv(const_cast< char * >("RTL_LOGFILE=/tmp/logfile1")); -#endif -#ifdef WNT - putenv("RTL_LOGFILE=c:\\temp\\logfile1"); -#endif -#ifdef LINUX - setenv("RTL_LOGFILE", "/tmp/logfile1", 0); -#endif - rtl_logfile_trace("trace %d\n", 2 ); - rtl_logfile_trace("trace %d %d\n" , 1,2 ); - rtl_logfile_trace("trace %d %d %d\n" , 1 , 2 ,3 ); - - rtl::OUString suFilePath = getTempPath(); - suFilePath += rtl::OUString("logfile1_") + getCurrentPID( ); - suFilePath += rtl::OUString(".log"); - - ::osl::FileBase::RC nError1; - ::osl::File aTestFile( suFilePath ); - printUString( suFilePath ); - nError1 = aTestFile.open ( osl_File_OpenFlag_Read ); - CPPUNIT_ASSERT_MESSAGE("create the log file: but the logfile does not exist", - ( ::osl::FileBase::E_NOENT != nError1 ) && - ( ::osl::FileBase::E_ACCES != nError1 ) ); - sal_Char buffer_read[400]; - sal_uInt64 nCount_read; - nError1 = aTestFile.read( buffer_read, 400, nCount_read ); - //printf("buffer is %s\n", buffer_read ); - CPPUNIT_ASSERT_MESSAGE("write right logs", strstr( buffer_read, "trace 1 2 3") != NULL ); - aTestFile.sync(); - aTestFile.close(); - /*// delete logfile on the disk - - nError1 = osl::File::remove( suFilePath ); - printError( nError1 ); - CPPUNIT_ASSERT_MESSAGE( "In deleteTestFile Function: remove ", ( ::osl::FileBase::E_None == nError1 ) || ( nError1 == ::osl::FileBase::E_NOENT ) ); - */ - } - //Profiling output should only be generated for a special product version of OpenOffice - // which is compiled with a defined preprocessor symbol 'TIMELOG'. Now, the symbol not defined - void logfile_002() - { -#ifdef SOLARIS - putenv(const_cast< char * >("RTL_LOGFILE=/tmp/logfile2")); -#endif -#ifdef WNT - putenv("RTL_LOGFILE=c:\\temp\\logfile2"); -#endif -#ifdef LINUX - setenv("RTL_LOGFILE", "/tmp/logfile2", 0); -#endif - RTL_LOGFILE_TRACE( "trace the log" ); - RTL_LOGFILE_TRACE1( "trace %d" , 1 ); - RTL_LOGFILE_TRACE2( "trace %d %d" , 1,2 ); - RTL_LOGFILE_TRACE3( "trace %d %d %d" , 1 , 2 ,3 ); -// TODO: assertion test! - } - - void logfile_003() - { -#ifdef SOLARIS - putenv(const_cast< char * >("RTL_LOGFILE=/tmp/logfile2")); -#endif -#ifdef WNT - putenv("RTL_LOGFILE=c:\\temp\\logfile2"); -#endif -#ifdef LINUX - setenv("RTL_LOGFILE", "/tmp/logfile2", 0); -#endif - RTL_LOGFILE_CONTEXT ( foo , "foo-function" ); - RTL_LOGFILE_CONTEXT_TRACE ( foo , "trace" ); - RTL_LOGFILE_CONTEXT_TRACE1 ( foo , "trace %d" , 1 ); - RTL_LOGFILE_CONTEXT_TRACE2 ( foo , "trace %d %d" , 1 , 2 ); - RTL_LOGFILE_CONTEXT_TRACE3 ( foo , "trace %d %d %d" , 1 , 2 , 3); -// TODO: assertion test! - } - - CPPUNIT_TEST_SUITE( logfile ); - CPPUNIT_TEST( logfile_001 ); - CPPUNIT_TEST( logfile_002 ); - CPPUNIT_TEST( logfile_003 ); - CPPUNIT_TEST_SUITE_END( ); - }; - -} // namespace rtl_logfile - -CPPUNIT_TEST_SUITE_REGISTRATION( rtl_logfile::logfile); - -CPPUNIT_PLUGIN_IMPLEMENT(); - -//~ do some clean up work after all test completed. -class GlobalObject -{ -public: - ~GlobalObject() - { - try - { - printf( "\n#Do some clean-ups ... only delete logfile1_*.log here!\n" ); - rtl::OUString suFilePath = getTempPath(); - suFilePath += rtl::OUString("logfile1_") + getCurrentPID( ); - suFilePath += rtl::OUString(".log"); - - //if ( ifFileExist( suFilePath ) == sal_True ) - ::osl::FileBase::RC nError1; - nError1 = osl::File::remove( suFilePath ); -#ifdef WNT - printf("Please remove logfile* manully! Error is Permision denied!"); -#endif - } - catch (const CppUnit::Exception &e) - { - printf("Exception caught in GlobalObject dtor(). Exception message: '%s'. Source line: %d\n", e.what(), e.sourceLine().lineNumber()); - } - catch (...) - { - printf("Exception caught (...) in GlobalObject dtor()\n"); - } - } -}; - -GlobalObject theGlobalObject; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sal/rtl/logfile.cxx b/sal/rtl/logfile.cxx deleted file mode 100644 index 637f2eb8640e..000000000000 --- a/sal/rtl/logfile.cxx +++ /dev/null @@ -1,227 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you 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 . - */ - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "osl/thread.h" -#include "osl/thread.hxx" - -#include - -#ifdef _MSC_VER -#define vsnprintf _vsnprintf -#endif - -using namespace osl; -using namespace std; - -using ::rtl::OUString; -using ::rtl::OUStringBuffer; - -namespace { - -OUString getFileUrl( const OUString &name ) -{ - OUString aRet; - if ( osl_getFileURLFromSystemPath( name.pData, &aRet.pData ) - != osl_File_E_None ) - { - SAL_WARN( - "sal.rtl", "osl_getFileURLFromSystemPath failed for \"" << name << '"'); - } - - OUString aWorkingDirectory; - osl_getProcessWorkingDir( &(aWorkingDirectory.pData) ); - osl_getAbsoluteFileURL( aWorkingDirectory.pData, aRet.pData, &(aRet.pData) ); - - return aRet; -} - -static const sal_Int32 g_BUFFERSIZE = 4096; - -struct Logger { - oslFileHandle aFile; - sal_Char *buffer; - osl::Mutex mutex; - - Logger(); - - ~Logger(); -}; - -Logger::Logger(): aFile(0), buffer(0) -{ - OUString name( "RTL_LOGFILE" ); - OUString value; - if( rtl_bootstrap_get( name.pData, &value.pData, 0 ) ) - { - // Obtain process id. - oslProcessIdentifier aProcessId = 0; - oslProcessInfo info; - info.Size = sizeof (oslProcessInfo); - if (osl_getProcessInfo (0, osl_Process_IDENTIFIER, &info) == osl_Process_E_None) - aProcessId = info.Ident; - - // Construct name of log file and open the file. - OUStringBuffer buf( 128 ); - buf.append( value ); - - // if the filename ends with .nopid, the incoming filename is not modified - if( value.getLength() < 6 /* ".nopid" */ || - rtl_ustr_ascii_compare_WithLength( - value.getStr() + (value.getLength()-6) , 6 , ".nopid" ) ) - { - buf.appendAscii( "_" ); - buf.append( (sal_Int32) aProcessId ); - buf.appendAscii( ".log" ); - } - - OUString o = getFileUrl( buf.makeStringAndClear() ); - oslFileError e = osl_openFile( - o.pData, &aFile, osl_File_OpenFlag_Write|osl_File_OpenFlag_Create); - - if( osl_File_E_None == e ) - { - TimeValue aCurrentTime; - buffer = ( sal_Char * ) rtl_allocateMemory( g_BUFFERSIZE ); - sal_Int64 nConverted = 0; - if (osl_getSystemTime (&aCurrentTime)) - { - nConverted = (sal_Int64 ) sprintf ( - buffer, - "opening log file %f seconds past January 1st 1970\n" - "corresponding to %" SAL_PRIuUINT32 " ms after timer start\n", - aCurrentTime.Seconds + 1e-9 * aCurrentTime.Nanosec, - osl_getGlobalTimer()); - - if( nConverted > 0 ) - { - sal_uInt64 nWritten; - osl_writeFile( aFile, buffer, nConverted , &nWritten ); - } - } - - nConverted = sprintf (buffer, "Process id is %" SAL_PRIuUINT32 "\n", aProcessId); - if( nConverted ) - { - sal_uInt64 nWritten; - osl_writeFile( aFile, buffer, nConverted, &nWritten ); - } - } - else - { - SAL_WARN( - "sal.rtl", - "Couldn't open logfile " << o << '(' << +e << ')'); - } - } -} - -Logger::~Logger() -{ - if( buffer ) - { - sal_Int64 nConverted = - sprintf( buffer, "closing log file at %06" SAL_PRIuUINT32, osl_getGlobalTimer() ); - if( nConverted > 0 ) - { - sal_uInt64 nWritten; - osl_writeFile( aFile, buffer, nConverted, &nWritten ); - } - osl_closeFile( aFile ); - rtl_freeMemory( buffer ); - } -} - -struct theLogger: public rtl::Static {}; - -} - -extern "C" void SAL_CALL rtl_logfile_trace ( const char *pszFormat, ... ) -{ - Logger & logger = theLogger::get(); - if( logger.buffer ) - { - va_list args; - va_start(args, pszFormat); - { - sal_Int64 nConverted; - MutexGuard guard( logger.mutex ); - nConverted = vsnprintf( logger.buffer , g_BUFFERSIZE, pszFormat, args ); - nConverted = (nConverted > g_BUFFERSIZE ? g_BUFFERSIZE : nConverted ); - if( nConverted > 0 ) - { - sal_uInt64 nWritten; - osl_writeFile( logger.aFile, logger.buffer, nConverted, &nWritten ); - } - } - va_end(args); - } -} - -extern "C" void SAL_CALL rtl_logfile_longTrace(char const * format, ...) { - Logger & logger = theLogger::get(); - if (logger.buffer != 0) { - sal_uInt32 time = osl_getGlobalTimer(); - oslThreadIdentifier threadId = osl::Thread::getCurrentIdentifier(); - va_list args; - va_start(args, format); - { - MutexGuard g(logger.mutex); - int n1 = snprintf( - logger.buffer, g_BUFFERSIZE, "%06" SAL_PRIuUINT32 " %" SAL_PRIuUINT32 " ", time, threadId); - if (n1 >= 0) { - sal_uInt64 n2; - osl_writeFile( - logger.aFile, logger.buffer, - static_cast< sal_uInt64 >( - std::min(n1, static_cast< int >(g_BUFFERSIZE))), - &n2); - n1 = vsnprintf(logger.buffer, g_BUFFERSIZE, format, args); - if (n1 > 0) { - osl_writeFile( - logger.aFile, logger.buffer, - static_cast< sal_uInt64 >( - std::min(n1, static_cast< int >(g_BUFFERSIZE))), - &n2); - } - } - } - va_end(args); - } -} - -extern "C" sal_Bool SAL_CALL rtl_logfile_hasLogFile( void ) { - return theLogger::get().buffer != 0; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sal/util/sal.map b/sal/util/sal.map index 6acd9c44470e..bca9c880e044 100644 --- a/sal/util/sal.map +++ b/sal/util/sal.map @@ -500,7 +500,6 @@ UDK_3_0_0 { rtl_addUnloadingListener; rtl_removeUnloadingListener; - rtl_logfile_trace; osl_getProcessLocale; osl_setProcessLocale; local: @@ -546,7 +545,6 @@ UDK_3.3 { osl_setCommandArgs; rtl_uStringbuffer_insertUtf32; rtl_ustr_ascii_compareIgnoreAsciiCase_WithLengths; - rtl_logfile_longTrace; rtl_ustr_asciil_reverseEquals_WithLength; } UDK_3.2; @@ -608,7 +606,6 @@ UDK_3.9 { # OOo 3.1 UDK_3.10 { # OOo 3.2 global: - rtl_logfile_hasLogFile; rtl_math_erf; rtl_math_erfc; rtl_math_asinh; diff --git a/solenv/gbuild/gbuild.help.txt b/solenv/gbuild/gbuild.help.txt index de69c33fd94a..be744fc4b9df 100644 --- a/solenv/gbuild/gbuild.help.txt +++ b/solenv/gbuild/gbuild.help.txt @@ -105,10 +105,6 @@ INTERACTIVE VARIABLES: 3... = debugging information + no optimizations + extra debug output (usually extremely verbose). Levels > 2 are not used very much. - TIMELOG / timelog - If not empty enable the RTL_LOGFILE_* time logging facility. - export RTL_LOGFILE=rtl_logfile.nopid when running office, to - get timestamps written out. PARALLELISM If not empty, pass argument on as the -j switch to recursive make invocations. Useful to lower/increase build parallelism individually. diff --git a/sw/inc/pch/precompiled_sw.hxx b/sw/inc/pch/precompiled_sw.hxx index 9f091e1d2bac..d3fb9fc9e727 100644 --- a/sw/inc/pch/precompiled_sw.hxx +++ b/sw/inc/pch/precompiled_sw.hxx @@ -642,7 +642,6 @@ #include #include #include -#include #include #include #include diff --git a/sw/source/core/doc/DocumentTimerManager.cxx b/sw/source/core/doc/DocumentTimerManager.cxx index a2ed9c4ba972..b677ac77a558 100644 --- a/sw/source/core/doc/DocumentTimerManager.cxx +++ b/sw/source/core/doc/DocumentTimerManager.cxx @@ -33,7 +33,6 @@ #include #include #include -#include namespace sw { diff --git a/vcl/inc/pch/precompiled_vcl.hxx b/vcl/inc/pch/precompiled_vcl.hxx index 56db30f8e284..ef5d36718dba 100644 --- a/vcl/inc/pch/precompiled_vcl.hxx +++ b/vcl/inc/pch/precompiled_vcl.hxx @@ -86,7 +86,6 @@ #include "osl/thread.h" #include "rtl/bootstrap.hxx" #include "rtl/instance.hxx" -#include "rtl/logfile.hxx" #include "rtl/math.hxx" #include "rtl/strbuf.hxx" #include "rtl/string.hxx" diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx index c0979a651892..49703e49b1bb 100644 --- a/vcl/source/app/svmain.cxx +++ b/vcl/source/app/svmain.cxx @@ -21,8 +21,6 @@ #include -#include "rtl/logfile.hxx" - #include #include diff --git a/vcl/win/source/gdi/salgdi3.cxx b/vcl/win/source/gdi/salgdi3.cxx index 4e76036dff58..732642c186d8 100644 --- a/vcl/win/source/gdi/salgdi3.cxx +++ b/vcl/win/source/gdi/salgdi3.cxx @@ -34,7 +34,6 @@ #include #include #include -#include #include #include #include -- cgit v1.2.3