Views: 1323
Number of votes: 4
Average rating:

Glimpse + Episerver = true

Glimpse is a great tool for checking what is going in under the hood in your application. Unlike the Chrome F12 tools, Glimpse can actually tell you what is going on on the server side, like

  • What is the stored in session?
  • How long was the execution time on the server?
  • What log messages did this request produce?
  • Who is the current user on server?
  • What MVC views were rendered?

It's really extendible and you can add new tabs and statistics to it. Unfortunately it doesn't work with Episerver out of the box. But with a few configuration changes it's no problem.

So how does it look on the Alloy site? In minimized mode it looks like:

Notice that you get information about the actual execution time on server? Sweet!

Let's check out the expanded mode if you click it:

Here I added a new tab for Episerver that includes the current page type and it's properties. I'll add more stuff to it in next version. The Session tab will give you information about what is stored for the current user. The trace tab is worth mentioning as well. With just a few lines of configuration to log4net you can get all your log messages from log4net here. 

Add a new appender in Episerverlog.config

<appender name="AspNetTraceAppender" type="log4net.Appender.AspNetTraceAppender" >
    <layout type="log4net.Layout.PatternLayout">
      <conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />

Use it...I'll switch in on for the root element to get everything (remember to switch it off when you are done...)

  <level value="All" />
  <appender-ref ref="AspNetTraceAppender" />

...and turn on trace in web.config

<trace writeToDiagnosticsTrace="true" enabled="true" pageOutput="false"/>

Done! Let's check it out!

Now you also get all log4net messages in the trace tab for every request! How sweet is that?

For security, I disabled Glimpse to only allow it to run if the user has one of the groups "CMSAdmins", "WebAdmins" or "GlimpseUser". That should take care of most security aspects. If you need additional security like only allowing it to run if you are browsing from the server itselt, that easy as well. 

Nuget package is available on Episerver feed for Episerver 10+ if you want to try it out. Feel free to ctrl-c any code you like on my github if you want to do it yourself. 

Happy Glimpsing!

Nov 30, 2016

( By valdis, 11/30/2016 7:55:59 PM)

Awesome! Btw, FeatureSwitch also has tab there ;)

( 12/2/2016 2:29:07 PM)

Thx! I got to check out Feature switch Valdis :)

It's on my todo list.

Branching might be funny...merging isn't.

Enter FeatureSwitch :)

Please login to comment.