View Issue Details

IDProjectCategoryView StatusLast Update
0026537PatchesLCLpublic2014-09-08 13:55
ReporterReinier OlislagersAssigned ToJuha Manninen  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Platformx64 (with x86 compiler)OSWindows 
Product Version1.3 (SVN) 
Target Version1.2.6 
Summary0026537: LazLogger: setting *_debuglog environment variable does not work: no log
DescriptionSetting e.g. environment variable for Lazarus, something like
set lazarus_debuglog=c:\windows\temp\lazlog.txt
then starting lazarus from command line gives no log file.

Reason: error in code: * in FEnvironmentForLogFileName is never replaced with executable name without extension.

Patch attached which fixes problem.

Suggest backporting to 1.2.x series
TagsNo tags attached.
Fixed in Revisionr46161
LazTarget-
WidgetsetWin32/Win64
Attached Files

Activities

Reinier Olislagers

2014-07-29 10:06

developer  

logenv.diff (821 bytes)   
Index: components/lazutils/lazlogger.pas
===================================================================
--- components/lazutils/lazlogger.pas	(revision 45986)
+++ components/lazutils/lazlogger.pas	(working copy)
@@ -641,7 +641,11 @@
   if FEnvironmentForLogFileName <> '' then begin;
     // if not found yet, then try to find in the environment variables
     if (length(result)=0) then begin
-      EnvVarName:= ChangeFileExt(ExtractFileName(ParamStrUTF8(0)),'') + FEnvironmentForLogFileName;
+      // Substitute * with executable filename without extension
+      EnvVarName:=StringReplace(FEnvironmentForLogFileName,
+        '*',
+        ChangeFileExt(ExtractFileName(ParamStrUTF8(0)),''),
+        [rfReplaceAll,rfIgnoreCase]);
       Result := GetEnvironmentVariableUTF8(EnvVarName);
     end;
   end;
logenv.diff (821 bytes)   

Reinier Olislagers

2014-09-08 09:57

developer   ~0076976

Would be nice if this could be committed as it is very useful for testing lhelp issues: lhelp gets started by the IDE so it is hard to specify debug log output without modifying the Laz code...

Juha Manninen

2014-09-08 10:40

developer   ~0076977

If you set:
  lazarus_debuglog=c:\windows\temp\lazlog.txt
then where does the '*' come from?

Reinier Olislagers

2014-09-08 10:56

developer   ~0076979

// Environment variable used to specify log file name
    // * is replaced by param(0) - the application name without extension
    // example/default: *_debuglog
    property EnvironmentForLogFileName: String read FEnvironmentForLogFileName write SetEnvironmentForLogFileName;

constructor TLazLoggerFile.Create;
  FEnvironmentForLogFileName := '*_debuglog';

Juha Manninen

2014-09-08 12:18

developer   ~0076980

Right. I applied the patch, thanks.

Reinier Olislagers

2014-09-08 13:55

developer   ~0076982

Thanks, Juha!

Issue History

Date Modified Username Field Change
2014-07-29 10:06 Reinier Olislagers New Issue
2014-07-29 10:06 Reinier Olislagers File Added: logenv.diff
2014-07-29 11:44 Martin Friebe Assigned To => Martin Friebe
2014-07-29 11:44 Martin Friebe Status new => assigned
2014-09-08 09:57 Reinier Olislagers Note Added: 0076976
2014-09-08 10:38 Juha Manninen Assigned To Martin Friebe => Juha Manninen
2014-09-08 10:40 Juha Manninen Note Added: 0076977
2014-09-08 10:40 Juha Manninen Status assigned => feedback
2014-09-08 10:56 Reinier Olislagers Note Added: 0076979
2014-09-08 10:56 Reinier Olislagers Status feedback => assigned
2014-09-08 12:18 Juha Manninen Fixed in Revision => r46161
2014-09-08 12:18 Juha Manninen Note Added: 0076980
2014-09-08 12:18 Juha Manninen Status assigned => resolved
2014-09-08 12:18 Juha Manninen Resolution open => fixed
2014-09-08 13:55 Reinier Olislagers Note Added: 0076982
2014-09-08 13:55 Reinier Olislagers Status resolved => closed