Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use application name in XmlFileErrorLog when logging an error #403

Open
nbulusanjr opened this issue May 25, 2016 · 10 comments
Open

Use application name in XmlFileErrorLog when logging an error #403

nbulusanjr opened this issue May 25, 2016 · 10 comments

Comments

@nbulusanjr
Copy link

No description provided.

@ThomasArdal
Copy link
Contributor

@nbulusanjr @atifaziz I did fix a similar issue in the memory error log. Maybe this code can just be ported to the XML file logger as well. Looks like it is missing the application name completely.

@atifaziz
Copy link
Member

atifaziz commented May 26, 2016

The application name setting was primarily designed to be used for isolation purposes where you'd want to share a single store like a database as the error log store across several applications. It doesn't make much sense in the case of XmlFileErrorLog where you can get isolation simply by using different path per application to store the XML files. This is not so much an issue at the time of writing as it is when listing the error log. ELMAH will have to crack open each XML file in a large directory of files to be able to filter by application. A database can do this efficiently via an index. The application name is not an integral part of the logged error but I think most people want to use it for informational purposes.

@atifaziz atifaziz changed the title Elmah.XmlFileErrorLog set application name not working Use application name in XmlFileErrorLog when logging an error May 26, 2016
@atifaziz
Copy link
Member

Since this is by-design, I've changed the title and label to reflect that this is an enhancement.

@ThomasArdal
Copy link
Contributor

But if you want to share the directory where XmlFileErrorLog puts its files between multiple applications (like a SAN), application name may still make sense, right?

@atifaziz
Copy link
Member

atifaziz commented May 26, 2016

@ThomasArdal It could but it cannot be efficiently implemented as I pointed out:

ELMAH will have to crack open each XML file in a large directory of files to be able to filter by application. A database can do this efficiently via an index.

The only way to make this work would be to use the application name as the last component of the file path and then each application's errors would sit isolated in a separate directory. Historically, this made sense if you configured the error log machine-wide via machine.config (e.g. in a shared application hosting environment) and then the only thing an app had left to do was configure it's application name. Isolation would then happen automagically if the error log implementation supported it. I would discourage anyone using XmlFileErrorLog in the same way even if it could be technically possible. It's meant for a lightweight solution where a database is not available.

@nbulusanjr
Copy link
Author

A guy from OrbitOne did an application thats logs to a central database and filter it using by application name. The design log an error to a xml file and an agent will check if there is a new xml file in your log directory and throws into a webservice.

@atifaziz
Copy link
Member

atifaziz commented May 26, 2016

@nbulusanjr I'm guessing you're referring to ASP.NET Exception Reporter (based on ELMAH)?

an agent will check if there is a new xml file in your log directory and throws into a webservice.

Can the agent not be configured with the application for which it is collecting?

@vyasabhishek
Copy link

Hi, I want to fix this issue in Elmah. Can I get access to make PR in master and publish new nuget for the same?

@atifaziz
Copy link
Member

@vyasabhishek You don't need any access rights to make a PR. You prepare the work in your fork and create a PR from there to here. Also, the fix should go primarily into the 1x branch as that relates to 1.x releases. As for NuGet, you'd need the package owners (@JamesDriscoll & I) to push out a release. @JamesDriscoll used to take care of most of the packaging but I think he's quite busy now.

vyasabhishek pushed a commit to vyasabhishek/Elmah that referenced this issue Nov 18, 2016
@vyasabhishek
Copy link

Thanks @atifaziz . I have created PR to main branch. I would appreciate, If you can review/merge that PR and publish a new version of Elmah.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants