Try our conversational search powered by Generative AI!

Daniel Ovaska
Nov 30, 2016
  2431
(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
The A/A Test: What You Need to Know

Sure, we all know what an A/B test can do. But what is an A/A test? How is it different? With an A/B test, we know that we can take a webpage (our...

Lindsey Rogers | Apr 15, 2024

.Net Core Timezone ID's Windows vs Linux

Hey all, First post here and I would like to talk about Timezone ID's and How Windows and Linux systems use different IDs. We currently run a .NET...

sheider | Apr 15, 2024

What's new in Language Manager 5.3.0

In Language Manager (LM) version 5.2.0, we added an option in appsettings.json called TranslateOrCopyContentAreaChildrenBlockForTypes . It does...

Quoc Anh Nguyen | Apr 15, 2024

Optimizely Search & Navigation: Boosting in Unified Search

In the Optimizely Search & Navigation admin view, administrators can set a certain weight of different properties (title, content, summary, or...

Tung Tran | Apr 15, 2024

Optimizely CMS – Getting all content of a specific property with a simple SQL script

When you need to retrieve all content of a specific property from a Page/Block type, normally you will use the IContentLoader or IContentRepository...

Tung Tran | Apr 15, 2024

Join the Content Recommendations Work Smarter webinar May 8th 16.00-16.45 CET with expert Aidan Swain

Learn more about Content Recommendations, with Optimizely’s very own Senior Solutions consultant, Aidan Swain . He will discuss best practices and...

Karen McDougall | Apr 12, 2024