How do I use log4net to generate log files in a WinForm program?

Pearl Ding 80 Reputation points
2024-01-10T10:42:08.48+00:00

How do I use log4net to generate log files in a WinForm program?

I need to put some strings into the log, and wrap after each entry. I also need to input these strings into a txt file.

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,289 questions
0 comments No comments
{count} votes

Accepted answer
  1. Jiale Xue - MSFT 48,876 Reputation points Microsoft Vendor
    2024-01-10T11:24:23.04+00:00

    Hi @Pearl Ding , Welcome to Microsoft Q&A,

    You can refer to this issue that has been discussed for a long time.:Log4net won't log to console (WinForms app).

    You can learn it on Log4Net's GitHub, or you can choose other logging providers:

    Third-party logging providers

    Best Regards,

    Jiale


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". 

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.