I want to implement the AppDomain.FirstChanceException in my WPF app, for optionally logging every exception that occurs, handled or not. I don't wish to log these exceptions to the targets I have configured for NLog. Is is possible, around the time of calling Logger.Error (or whatever Logger method) to make NLog only log to one particular target?
Is it possible to tell dynamically NLog which target to log to?
2.2k Views Asked by ProfK At
1
There are 1 best solutions below
Related Questions in WPF
- Sorting a List by its property renames all the objects in the List
- Can't open new instance of another window in my app, in WPF .NET 8
- Binding forecolour and ToolTip to a DataGrid
- how to create Infinite Upgrades in a clicker game
- Try Catch exception is not catching the unhandled exception
- Assigning an object to another doesn't raise PropertyChanged event in WPF
- Masking input in TextBox
- What should I do if Visual Studio has a restriction on creating files with a long name or a long path to these files?
- reading configuration file (mytest.exe.config)
- WPF Windows Initializing is locking the separated thread in .Net 8
- How to bind to the DataContext ViewModel of another view?
- mouse coordinates in image go below 0 and above width
- WPF pop up is behaving differently in English language PC and Japanese language PC
- Multi level project reference using dll
- Unable to unzip archive .NET framework
Related Questions in LOGGING
- ModuleNotFoundError: No module named 'src' while importing logging
- How to get domains in Shadowsocks server log with Shadowsocks Android
- How to enable log to console Cosmos Client SDK requests
- pino-pretty logging special characters as literal
- unable to serialize JSON type logs In fluentd(logging-operator)
- How to configure different loggers separately in structlog?
- detect catalina.out log path from a running tomcat on non-Windows
- apache2 rotatelogs creates log file but its empty when deployed to azure web app
- Ubuntu:24.04 Container generating excessive logs
- Transform Load pipeline for a logs system: Apache Airflow or Kafka Connect?
- Deisred log is not rotating
- Purpose of setting debug="false" in log4j at configuration level
- RobotFramework hangs after xx lines of log
- logging in multiprocess writes to same log
- Masking in logback.xml with all request and responses
Related Questions in NLOG
- NLog is not writing when using nlogsettings.json file
- NLog Memory Target is not generating logs
- NLog with NServiceBus
- NLog custom layout renderer for "EventProperties" is not working
- How do I extract the parameters individually?
- JSON logging in NLog
- Archive Daily But Split Large Log files?
- .net core 7 logging with nlog does not working
- NLog upgrade issue
- Nlog Callsite layout render captures complete stack trace
- Getting formatted output of ILogger.Log for other destination
- NLog.Extensions.Logging and a custom inherited logger
- NLog sublog alternative
- NLog JSON layout doesn't render nested properties if value is null
- NLog not always logging as the right class?
Related Questions in UNHANDLED-EXCEPTION
- SymFromAddr fails on AMD Machine with the error message "Attempt to access Invalid address"
- VB Application - Unhandle Exception not working in Release mode
- Error code: Unhandled Exception (Identation error)
- InvalidOperationException for dropdown filter in ASP.NET Core MVC
- UnhandledException in WinUI3 coming from background thread: How to show dialog with technical error info to the user?
- How to trap UIThreadException and UnhandledException in Windows Forms, Net Framework
- Unhandled Exception in C++ OpenCV Color Detection Program
- Why is Visual Studio 2022 not highlighting my code when an Unhandled Exception is thrown?
- iostream library doesn't work using Qt's cmake
- Firebase PlatformException(channel-error, Unable to establish connection on channel., null, null)
- Excel add-in with shared runtime - unhandled exception on displayDialogAsync
- Fatal error detected: Module object for pyimod02_importers is NULL
- Exception isn't handled while occuring in a try block in C++
- The XAML Designer unhandled exception. (Exit code: e0434352)
- How to handle exceptions in razor.cs files and display them globally in the console? BlazorWebAssembly
Related Questions in FIRST-CHANCE-EXCEPTION
- First-chance exception, Microsoft C++ exception: EEFileLoadException at memory location
- Can unmanaged first chance exception cause a crash/restart?
- CDOSYS first-chance exceptions on raw_Send() and raw_GetStream()
- C# First chance exception incomplete stack trace
- Finding true source of an first chance exception
- Generate dumps on first chance exceptions of multiple instances of an application
- First-chance exception at 0x772BDBB7 in game.exe: 0xC0000008: An invalid handle was specified
- Disabled first-chance-exception but debugger stopps within try...catch when using IronPython
- First-chance exception at 0x761EC42D in foo.exe: Microsoft C++ exception: int at memory location 0x003ED1EC
- Visual Studio break on first chance exception not working
- How do I fix Access violation writing exception
- A first chance exception of type 'System.IndexOutOfRangeException' in exe in output window
- libpng 1.616 crashing on png_read_png in VS2012 C++
- BuildManager.Build Encounters First Chance Exceptions in SQL Server Data Tools Project
- Is it possible to tell dynamically NLog which target to log to?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
It's possible, but this is not a good idea because:
Configuration file:
Example of a global factory configuration:
Example of a user created factory configuration:
log1.txt
log2.txt
Soulution
The best solution of the problem is to create two factories and one logger for each factory. The factories and loggers must be initialized before you subscribe to
AppDomain.FirstChanceException. Otherwise, you will have problems with thread safety if you have async operations or other threads.