Open Xarkam opened 6 years ago
++ For Serilog support
agree!
Find the solution
Find the solution
Could you please provide the xml for your solution?
These settings worked for me after restarting the IDE:
Message pattern: ^(\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}\.\d{3}\s[\+\-]\d{2}:\d{2})\s+\[(\w+)\]\s+(\S+:\d+)\s+\[(\S+)\]\s+(.*)$
Message start pattern: ^\d
Time format: yyyy-MM-dd HH:mm:ss.SSS XXX
Time capture group: 1
Severity capture group: 2
Category capture group: 4
Then I added the dates and severity as separate Patterns
to get some highlighting... don't get why you would have to do it twice, but ok
Here's the XML
<State>
<highlightingPatterns>
<LogHighlightingPattern enabled="true" pattern="^\s*(e(rror)?|severe)\s*$" action="HIGHLIGHT_LINE" fg="-39836" bold="true" italic="false" stripe="true" uuid="de2d3bb2-78c9-4beb-835e-d483c35c07b6" />
<LogHighlightingPattern enabled="true" pattern="^\s*w(arn(ing)?)?\s*$" action="HIGHLIGHT_LINE" fg="-6329600" bold="true" italic="false" stripe="false" uuid="11ff1574-2118-4722-905a-61bec89b079e" />
<LogHighlightingPattern enabled="true" pattern="^\s*i(nfo)?\s*$" action="HIGHLIGHT_LINE" fg="-10316203" bold="false" italic="false" stripe="false" uuid="5e882ebc-2179-488b-8e1a-2fe488636f36" />
<LogHighlightingPattern enabled="true" pattern="^\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}\.\d{3}\s[\+\-]\d{2}:\d{2}" action="HIGHLIGHT_FIELD" fg="-10373377" bold="false" italic="false" stripe="false" uuid="4a787cef-27f8-4d40-b132-4291e5a439c2" />
</highlightingPatterns>
<hiddenSubstrings />
<parsingPatterns>
<LogParsingPattern enabled="true" name="Pipe-separated" pattern="^(?s)([^|]*)\|([^|]*)\|([^|]*)\|(.*)$" timePattern="HH:mm:ss.SSS" linePattern="^\d" timeId="0" severityId="1" categoryId="2" fullmatch="false" uuid="b5772998-bf1e-4d9d-ab41-da0b86451163" />
<LogParsingPattern enabled="true" name="IntelliJ IDEA" pattern="^([^\[]+)(\[[\s\d]+])\s*(\w*)\s*-\s*(\S*)\s*-(.+)$" timePattern="yyyy-MM-dd HH:mm:ss,SSS" linePattern="^\d" timeId="0" severityId="2" categoryId="3" fullmatch="false" uuid="8a0e8992-94cb-4f4c-8be2-42b03609626b" />
<LogParsingPattern enabled="true" name="TeamCity build log" pattern="^\[([^]]+)](.):\s*(\[[^]]+])?(.*)$" timePattern="HH:mm:ss" linePattern="^\[" timeId="0" severityId="1" categoryId="2" fullmatch="false" uuid="e9fa2755-8390-42f5-a41e-a909c58c8cf9" />
<LogParsingPattern enabled="true" name="Whim" pattern="^(\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}\.\d{3}\s[\+\-]\d{2}:\d{2})\s+\[(\w+)\]\s+(\S+:\d+)\s+\[(\S+)\]\s+(.*)$" timePattern="yyyy-MM-dd HH:mm:ss.SSS XXX" linePattern="^\d" timeId="0" severityId="1" categoryId="3" fullmatch="false" uuid="7a50932c-fdf4-4c5f-beae-08bcde54b678" />
</parsingPatterns>
<settingsVersion>7</settingsVersion>
<lastAddedDefaultFormat>b5772998-bf1e-4d9d-ab41-da0b86451163,8a0e8992-94cb-4f4c-8be2-42b03609626b,e9fa2755-8390-42f5-a41e-a909c58c8cf9</lastAddedDefaultFormat>
<errorStripeModel>heatmap</errorStripeModel>
<readonlySizeThreshold>16</readonlySizeThreshold>
<highlight_links>true</highlight_links>
</State>
Just in case someone else stumbles across this thread and needs help with a completely basic serilog implementation:
big code blocks for easy copying
Message pattern:
^(?s)([^\[]*)\[([^\]]*)\]([^\]]*)(.*)$
Message start pattern:
^\d
Time format:
yyyy-MM-dd HH:mm:ss.SSS XXX
Patterns:
^\s*ERR?\s*$
^\s*WRN?\s*$
^\s*INF?\s*$
^\s*DBG?\s*$
Just for reference, this is how I implemented serilog in an asp.net core project:
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Debug()
.WriteTo.Async(a => a.File($"Logs/{Assembly.GetExecutingAssembly().GetName().Name}.log", rollingInterval: RollingInterval.Day))
.WriteTo.Async(a => a.Console())
.CreateLogger();
builder.Logging.ClearProviders();
builder.Logging.AddSerilog();
It's kind of the most basic implementation there is but it's a good starting point and works with the settings up top :)
Hey, just created the related PR: https://github.com/JetBrains/ideolog/pull/192
Hello, I tried to add templates for serilog support, but I can't do it. I make a log formats pattern: Message pattern:
^(?s)([^\[]*)\[([^\]]*)\]([^\]]*)(.*)$
Message start pattern:^\d
Time format:yyyy-MM-dd HH:mm:ss.SSS
I create a Patterns:
^\s*i(nformation)?\s*$
in hightlight line mode.But nothing is highlighted.
Here a piece of a log file:
What did I do wrong?