November Happy Hour will be moved to Thursday December 5th.

Daniel Ovaska
Nov 30, 2016
  2561
(5 votes)

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" />
    </layout>
</appender>

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

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

...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

Comments

valdis
valdis Nov 30, 2016 07:55 PM

Awesome! Btw, FeatureSwitch also has tab there ;)

Dec 2, 2016 02:29 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 :)

Deepa Puranik
Deepa Puranik Feb 1, 2021 08:14 AM

Hi,

How to add the EPiServer tab to the glimpse ?

Can you please help me how to configure tabs for glimpse.

Daniel Ovaska
Daniel Ovaska Feb 9, 2021 01:18 PM

Added support for Episerver v11 to Episerver nuget feed. Will be up when approved.

Please login to comment.
Latest blogs
Optimizely SaaS CMS DAM Picker (Interim)

Simplify your Optimizely SaaS CMS workflow with the Interim DAM Picker Chrome extension. Seamlessly integrate your DAM system, streamlining asset...

Andy Blyth | Nov 21, 2024 | Syndicated blog

Optimizely CMS Roadmap

Explore Optimizely CMS's latest roadmap, packed with developer-focused updates. From SaaS speed to Visual Builder enhancements, developer tooling...

Andy Blyth | Nov 21, 2024 | Syndicated blog

Set Default Culture in Optimizely CMS 12

Take control over culture-specific operations like date and time formatting.

Tomas Hensrud Gulla | Nov 15, 2024 | Syndicated blog

I'm running Optimizely CMS on .NET 9!

It works 🎉

Tomas Hensrud Gulla | Nov 12, 2024 | Syndicated blog