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

FileNotFoundException on log4net.dll when running inside other application #15

Closed
brinkdinges opened this issue Jan 9, 2018 · 4 comments
Closed

Comments

@brinkdinges
Copy link

@brinkdinges brinkdinges commented Jan 9, 2018

Hi there,

I'm developing an addin for an existing application and I'm currently in the process of adding log4net. I'd love to be able to log to Loggly as well.

From my current understanding, my plugin isn't a complete application and therefore app.config doesn't work for configuring log4net. I got it writing to a text file using this example. Now as soon as I add a reference to log4net.loggly, I get a FileNotFoundException on the log4net dll. It only works when I copy the dll manually to the host application folder.

This my code to initialize the LogglyAppender (plus a "using log4net.loggly;" ):

            var logglyAppender = new LogglyAppender
            {
                RootUrl = "https://logs-01.loggly.com/",
                InputKey = "<my input key>",
                Tag = "<my tag>",
                Layout = patternLayout
            };

            logglyAppender.ActivateOptions();
            hierarchy.Root.AddAppender(logglyAppender);

Can this be caused by the way you handle references? What can I change in your or my code to get this working without copying the dll?

@mostlyjason
Copy link

@mostlyjason mostlyjason commented Jan 9, 2018

This is an interesting example developing a plug-in because normally people make applications. I'm not a .net expert, but do you need to add the library reference to your solution? I'm assuming it will need to be bundled with your plugin when you build the release.

@brinkdinges
Copy link
Author

@brinkdinges brinkdinges commented Jan 9, 2018

Thanks for your answer Jason. The references are already added and log4net works when I'm not making use of Loggly functions. I'm also assuming that everything needs to be bundled on release.

I posted my question here as well:
angelsix/solidworks-api#16

The structure is Solidworks > SolidDna wrapper (from the link) > my code. Apparently we run inside the SolidWorks appDomain and therefore it looks in the application folder for the log4net dll when referenced by Loggly. It's still unclear why log4net works on itself, but its a start :)

@Katulus
Copy link

@Katulus Katulus commented Jan 29, 2019

@brinkdinges is this still an issue or was the cause in SolidWorks?

@brinkdinges
Copy link
Author

@brinkdinges brinkdinges commented Jan 30, 2019

It turned out that SolidDna, that sits between my add-in and SolidWorks, wasn't able to load external DLLs. It does now, so no fault of Loggly or log4net.

Thanks for bringing it up though, sorry that I didn't mention this sooner.

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

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.