You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by ar...@apache.org on 2012/10/15 06:36:41 UTC
svn commit: r1398194 - in /incubator/ooo/trunk/main:
extensions/source/logging/loggerconfig.cxx
officecfg/registry/schema/org/openoffice/Office/Logging.xcs
Author: arielch
Date: Mon Oct 15 04:36:40 2012
New Revision: 1398194
URL: http://svn.apache.org/viewvc?rev=1398194&view=rev
Log:
#i121216# - Allow unique logger file name
Modified:
incubator/ooo/trunk/main/extensions/source/logging/loggerconfig.cxx
incubator/ooo/trunk/main/officecfg/registry/schema/org/openoffice/Office/Logging.xcs
Modified: incubator/ooo/trunk/main/extensions/source/logging/loggerconfig.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/extensions/source/logging/loggerconfig.cxx?rev=1398194&r1=1398193&r2=1398194&view=diff
==============================================================================
--- incubator/ooo/trunk/main/extensions/source/logging/loggerconfig.cxx (original)
+++ incubator/ooo/trunk/main/extensions/source/logging/loggerconfig.cxx Mon Oct 15 04:36:40 2012
@@ -25,6 +25,7 @@
#include "precompiled_extensions.hxx"
#include "loggerconfig.hxx"
+#include <stdio.h>
/** === begin UNO includes === **/
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
@@ -40,6 +41,8 @@
/** === end UNO includes === **/
#include <tools/diagnose_ex.h>
+#include <osl/process.h>
+#include <rtl/ustrbuf.hxx>
#include <comphelper/componentcontext.hxx>
@@ -104,9 +107,47 @@ namespace logging
try { sLoggerName = _rxLogger->getName(); }
catch( const Exception& ) { DBG_UNHANDLED_EXCEPTION(); }
+ TimeValue aTimeValue;
+ oslDateTime aDateTime;
+ OSL_VERIFY( osl_getSystemTime( &aTimeValue ) );
+ OSL_VERIFY( osl_getDateTimeFromTimeValue( &aTimeValue, &aDateTime ) );
+
+ char buffer[ 30 ];
+ const size_t buffer_size = sizeof( buffer );
+
+ snprintf( buffer, buffer_size, "%04i-%02i-%02i",
+ (int)aDateTime.Year,
+ (int)aDateTime.Month,
+ (int)aDateTime.Day );
+ rtl::OUString sDate = rtl::OUString::createFromAscii( buffer );
+
+ snprintf( buffer, buffer_size, "%02i-%02i-%02i.%03i",
+ (int)aDateTime.Hours,
+ (int)aDateTime.Minutes,
+ (int)aDateTime.Seconds,
+ ::sal::static_int_cast< sal_Int16 >( aDateTime.NanoSeconds / 10000000 ) );
+ rtl::OUString sTime = rtl::OUString::createFromAscii( buffer );
+
+ rtl::OUStringBuffer aBuff;
+ aBuff.append( sDate );
+ aBuff.append( sal_Unicode( '.' ) );
+ aBuff.append( sTime );
+ rtl::OUString sDateTime = aBuff.makeStringAndClear();
+
+ oslProcessIdentifier aProcessId = 0;
+ oslProcessInfo info;
+ info.Size = sizeof (oslProcessInfo);
+ if ( osl_getProcessInfo ( 0, osl_Process_IDENTIFIER, &info ) == osl_Process_E_None)
+ aProcessId = info.Ident;
+ rtl::OUString aPID = rtl::OUString::valueOf( sal_Int64( aProcessId ) );
+
Variable aVariables[] =
{
- Variable( RTL_CONSTASCII_USTRINGPARAM( "$(loggername)" ), sLoggerName )
+ Variable( RTL_CONSTASCII_USTRINGPARAM( "$(loggername)" ), sLoggerName ),
+ Variable( RTL_CONSTASCII_USTRINGPARAM( "$(date)" ), sDate ),
+ Variable( RTL_CONSTASCII_USTRINGPARAM( "$(time)" ), sTime ),
+ Variable( RTL_CONSTASCII_USTRINGPARAM( "$(datetime)" ), sDateTime ),
+ Variable( RTL_CONSTASCII_USTRINGPARAM( "$(pid)" ), aPID )
};
for ( size_t i = 0; i < sizeof( aVariables ) / sizeof( aVariables[0] ); ++i )
Modified: incubator/ooo/trunk/main/officecfg/registry/schema/org/openoffice/Office/Logging.xcs
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/officecfg/registry/schema/org/openoffice/Office/Logging.xcs?rev=1398194&r1=1398193&r2=1398194&view=diff
==============================================================================
--- incubator/ooo/trunk/main/officecfg/registry/schema/org/openoffice/Office/Logging.xcs (original)
+++ incubator/ooo/trunk/main/officecfg/registry/schema/org/openoffice/Office/Logging.xcs Mon Oct 15 04:36:40 2012
@@ -52,9 +52,21 @@
</info>
<prop oor:name="FileURL" oor:type="xs:string">
<info>
- <desc>Specifies the file URL for the log handler. The default value here will expand to a file
- with the same name as the logger for which the handler is used, with extension ".log".
- It will be located in the user's OOo data folder.</desc>
+ <desc>Specifies the file URL for the log handler.
+ This URL will be resolved using the
+ ::com::sun::star::util::PathSubstitution service. That is, it is
+ allowed to include placeholders supported by that service,
+ such as $(userurl). Beside these, the following default
+ placeholders can also be included:
+ $(loggername) - the name of the logger
+ $(date) - the current date
+ $(time) - the current time
+ $(datetime) - the current date time
+ $(pid) - the process identifier
+ The default value here will expand to a file with the same name
+ as the logger for which the handler is used, with extension ".log".
+ It will be located in the user's OOo data folder.
+ </desc>
</info>
<value>$(userurl)/$(loggername).log</value>
</prop>