Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Daniel Ovaska
Nov 30, 2016
  2439
(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
Solving the mystery of high memory usage

Sometimes, my work is easy, the problem could be resolved with one look (when I’m lucky enough to look at where it needs to be looked, just like th...

Quan Mai | Apr 22, 2024 | Syndicated blog

Search & Navigation reporting improvements

From version 16.1.0 there are some updates on the statistics pages: Add pagination to search phrase list Allows choosing a custom date range to get...

Phong | Apr 22, 2024

Optimizely and the never-ending story of the missing globe!

I've worked with Optimizely CMS for 14 years, and there are two things I'm obsessed with: Link validation and the globe that keeps disappearing on...

Tomas Hensrud Gulla | Apr 18, 2024 | Syndicated blog

Visitor Groups Usage Report For Optimizely CMS 12

This add-on offers detailed information on how visitor groups are used and how effective they are within Optimizely CMS. Editors can monitor and...

Adnan Zameer | Apr 18, 2024 | Syndicated blog