Skip to content

NLog format ${longdate}|${level}|${logger}|${message} #40

@runtimevic

Description

@runtimevic

Hello

It is possible to have the NLog format??

${longdate}|${level}|${logger}|${message}

2025-05-04 15:30:25.1234|INFO|MiAplicacion.Program|Inicio de la aplicación.
2025-05-04 15:30:26.5678|DEBUG|MiAplicacion.Program|Verificando configuración de usuario.
2025-05-04 15:30:27.9876|ERROR|MiAplicacion.BaseDeDatos|Error al conectar con la base de datos.
2025-05-04 15:30:28.6543|WARN|MiAplicacion.Validaciones|Advertencia: Parámetro de entrada inválido.
2025-05-04 15:30:29.1122|INFO|MiAplicacion.Seguridad|El usuario se ha autenticado correctamente.
2025-05-04 15:30:30.2345|FATAL|MiAplicacion.Sistema|Error fatal: El sistema se detuvo inesperadamente.

NLog is quite flexible and allows you to customize the date and time format. However, NLog doesn't directly use the date and time format 2025-05-04-11:47:05.906, as the default separators are spaces and colons (:), rather than hyphens (-).

2025-05-04-13:04:45.417|Error|Let´s log some values: 10 - or some symbols: _myInt [INT] : 10
2025-05-04-13:04:45.417|Debug|This is a debug message.
2025-05-04-13:04:45.417|Error|This is an error message.

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions