Code Monkey home page Code Monkey logo

nlog.targets.mauilog's Introduction

NLog

NuGet Semantic Versioning NuGet downloads

Coverage

NLog is a free logging platform for .NET with rich log routing and management capabilities. It makes it easy to produce and manage high-quality logs for your application regardless of its size or complexity.

It can process diagnostic messages emitted from any .NET language, augment them with contextual information, format them according to your preference and send them to one or more targets such as file or database.

Major and minor releases will be posted on project news.

Getting started

For the possible options in the config, check the Options list and API Reference

Having troubles? Check the troubleshooting guide


ℹī¸ NLog 5.0 Released!

NLog 5.0 is finally here. See List of major changes in NLog 5.0

NLog Packages

The NLog-nuget-package provides everything needed for doing file- and console-logging. But there are also multiple NLog extension packages, that provides additional target- and layout-output. See targets and layout renderers overview!

See Nuget/build status of all official packages here

Questions, bug reports or feature requests?

Issues with getting it working? Please check the troubleshooting guide before asking! With a clear error message, it's really easier to solve the issue!

Unclear how to configure NLog correctly of other questions? Please post questions on StackOverflow.

Do you have feature request or would you like to report a bug? Please post them on the issue list and follow these guidelines.

Frequently Asked Questions (FAQ)

See FAQ on the Wiki

Contributing

As the current NLog team is a small team, we cannot fix every bug or implement every feature on our own. So contributions are really appreciated!

If you like to start with a small task, then up-for-grabs are nice to start with.

Please note, we have a dev and master branch

  • master is for pure bug fixes and targets NLog 4.x
  • dev targets NLog 5

A good way to get started (flow)

  1. Fork the NLog repos.
  2. Create a new branch in you current repos from the 'dev' branch. (critical bugfixes from 'master')
  3. 'Check out' the code with Git or GitHub Desktop
  4. Check contributing.md
  5. Push commits and create a Pull Request (PR) to NLog

Please note: bugfixes should target the master branch, others the dev branch (NLog 5)

License

NLog is open source software, licensed under the terms of BSD license. See LICENSE.txt for details.

How to build

Use Visual Studio 2019 and open the solution 'NLog.sln'.

For building in the cloud we use:

  • AppVeyor for Windows- and Linux-builds
  • SonarQube for code coverage

Trying to build your fork in the cloud? Check this how-to

Note: master points to NLog 4.x and dev to NLog 5.x

nlog.targets.mauilog's People

Contributors

304notmodified avatar snakefoot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

nlog.targets.mauilog's Issues

Not getting all log files from Android 11 device running .Net Maui 8 App

When I attempt to upload logs from our application, we execute the following code to get all the log files on the device:

    public static string NLogDefaultPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "/logs/";

    /// <returns></returns>
    public async Task<IEnumerable<string>> FetchLogsAsync()
    {
        var logFiles = Directory.GetFiles(AppConstants.NLogDefaultPath);

        var logs = new List<string>();

        foreach (var log in logFiles)
        {
            logs.Add(await File.ReadAllTextAsync(log));
        }

        return logs;
    }

I test in a scenario where I did some logged events in the app on 05/29/2024. I shut down the app at the end of the day. I then started the app up in the morning (5/30/2024) on the device and performed more logged events. I then attempted to upload the log files. When the above code ran, it only found 1 file and that file contained the logged events from 5/29/2024. I did a few more things in the app and kept testing over the next hour or so. Then after an hour or so, the above code found another log file, it was uploaded and it contained the logged events for 5/30/2024. I am trying to figure out why there was a delay in the above code seeing the second log file. This is a huge issue as when we are attempting to trouble shoot issue in production we are often getting log files that do not cover the period of time the issue occurred. I ensured I am running all the latest NLog nuget packages. The device is running Android 11 and the app is created using .Net Maui 8. Any information would be greatly appreciated.

Invalid target in nlog config

When following the instructions in the Readme, the target is not recognized by the xsd schema:

image

What am I missing?

using
Nlog 5.1.1
Nlog.Targets.MauiLog 1.0.2

Add Maui FileSystem LayoutRenderer

Cache directory (Returns the LocalCacheFolder directory)

FileSystem.Current.CacheDirectory;

C:/Users/{MyName}/AppData/Local/Packages/{GUID}_{hash}/LocalCache/

App data directory (Returns the LocalFolder directory that is backed up to the cloud)

FileSystem.Current.AppDataDirectory;

C:/Users/{MyName}/AppData/Local/Packages/{GUID}_{hash}/LocalState/

For NetStandard (and others) then it can just return:

System.AppContext.BaseDirectory

https://docs.microsoft.com/en-us/dotnet/maui/platform-integration/storage/file-system-helpers?tabs=windows

Notice MAUI performs virtualization so when resolving SpecialFolder.LocalApplicationData then it automatically redirect to custom folder:

C:/Users/{MyName}/AppData/Local/Packages/{GUID}_{hash}/LocalCache/

Missing Preserve Attribute for AppleOSLogTarget

Xamarin.iOS will not load the MauiLog Target unless the following is added somewhere in the iOS portion of the solution.
[assembly: Preserve(typeof(NLog.Targets.AppleOSLogTarget), AllMembers = true)]

This should either be put in AppleOSLogTarget directly or should be noted in the readme.

Setup build pipeline with AppVeyor

AppVeyor-file is ready, so just need the last push

NLog.Targets.Xamarin is now replaced by NLog.Targets.MauiLog, since Xamarin will reach end-of-life at May 1, 2024

Path for retrieving the log

Where do I get the log file from android phone? Does it need to config to specific path to get the log file? Or does it just log to the output only?

Trouble finding logs in iOS

I'm using the NLog MAUI library v5.2.0 for debugging my MAUI Android and iOS application created using Visual studio.
I'm not using a file and instead I'm using write to MAUI log. I can see the Android logs I've added in the device logs through logcat.
However on an iOS device i don't see the logs I've added in the device logs. Nor do I see them in the console. I've tried checking the boxes for debug and info logs in the console actions as well. Where can I see these logs on iOS.

Is this a noop target?

I've tried using this target in my application but it appears do be doing nothing at all.
I then tried to run the example application - no logs in logcat
I then checked the example app for any log calls - there are none.

Has this target been tested at all yet?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤ī¸ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.