dotnet / orleans

Cloud Native application framework for .NET
https://docs.microsoft.com/dotnet/orleans
MIT License
10.07k stars 2.03k forks source link

Orleans 1.3.1 does not write to log file when run as a service #2776

Closed sbrohi15 closed 7 years ago

sbrohi15 commented 7 years ago

Hi,

I have recently upgraded my application to use the Orleans 1.3.1 runtime from version 1.0.10.

However, while running both my host and client as windows services, I do not see any log file generated - neither the Orleans host service log or my application log from my log4net rolling file appender configuration.

I have attached both my application configuration and OrleansConfiguration.xml files to this ticket. Please review if there is anything I need to change.

I am only able to generate log files when I run my services in standalone mode via the "/standalone" switch in powershell.

This is the last remaining issue I have to resolve before getting my application running with Orleans 1.3.1

It is quite an urgent one, so I would definitely appreciate assistance as soon as possible.

EImporterOrleans.txt OrleansConfiguration.txt

Thank you,

Shazad Brohi

sergeybykov commented 7 years ago

How did you consume the logs in 1.0.10? Via .NET Trace or via log files? What happens if you specify an explicit path for log files (e.g. TraceFileName="D:\eImporter\") pointing to a directory that the process has write access to?

sbrohi15 commented 7 years ago

@sergeybykov We consumed the logs in 1.0.10 via log files. I also tried specifying the "TraceToFile=D:\eImporter{0}-{1}.log" attribute in my OrleansConfiguration.xml file, started the services, but did not see any log file generated in my D:\eImporter directory.

What type of changes do I need to make (if any) to my OrleansConfiguration.xml file in order to support writing out to log files when running the services?

Attached is a copy of the updated OrleansConfiguration.xml file I used.

OrleansConfiguration.txt

sbrohi15 commented 7 years ago

@sergeybykov Any update on this? I would like to use this version of Orleans as opposed to my current version (1.0.10) since there are many benefits, but I must be able to resolve this logging issue first. We also have other applications which use this framework, so any solution provided here would be very important.

sergeybykov commented 7 years ago

I'm unable to download the file you posted - https://github.com/dotnet/orleans/files/804535/OrleansConfiguration.txt. Has it been deleted?

< Tracing TraceToFile="d:\elimporter\eImporter{0}-{1}.log" /> should be sufficient to enable logging to files in the directory.

Do you get traces in the console?

benjaminpetit commented 7 years ago

Console output is deactivated if Environment.UserInteractive return false (which is the case if you run in a windows service). Maybe it is the issue?

sbrohi15 commented 7 years ago

@sergeybykov I get traces in the console, but even with TraceToFile attribute, I still do not see any logs generated. When I run service in standalone mode through PowerShell, I can see the log files being generated.

I have pasted the contents of my OrleansConfiguration.xml file below.

`<?xml version="1.0" encoding="utf-8"?>

`
sergeybykov commented 7 years ago

TraceToFile needs to be defined within < Tracing />, not < Statistics />.

sbrohi15 commented 7 years ago

Okay, I will try that.

sbrohi15 commented 7 years ago

@sergeybykov That worked. Thanks.