Skip to content

Commit 74832ad

Browse files
committed
Patch by tawee80 for custom log location detection
1 parent f14cbca commit 74832ad

2 files changed

Lines changed: 22 additions & 4 deletions

File tree

SharePointLogViewer/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,5 @@
5151
// You can specify all the values or you can default the Build and Revision Numbers
5252
// by using the '*' as shown below:
5353
// [assembly: AssemblyVersion("1.0.*")]
54-
[assembly: AssemblyVersion("2.6.2.0")]
55-
[assembly: AssemblyFileVersion("2.6.2.0")]
54+
[assembly: AssemblyVersion("2.6.3.0")]
55+
[assembly: AssemblyFileVersion("2.6.3.0")]

SharePointLogViewer/SPUtility.cs

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,13 @@ public static ICollection TraceSeverities
139139
public static string GetLogsLocation()
140140
{
141141
string logLocation = String.Empty;
142+
142143
if (IsWSSInstalled)
143144
{
144145
logLocation = GetSPDiagnosticsLogLocation();
145-
if (logLocation == String.Empty)
146+
if (String.IsNullOrEmpty(logLocation))
147+
logLocation = GetCustomLogLocation();
148+
if (String.IsNullOrEmpty(logLocation))
146149
logLocation = GetStandardLogLocation();
147150
}
148151

@@ -232,6 +235,21 @@ private static string GetStandardLogLocation()
232235
return logLocation;
233236
}
234237

238+
static string GetCustomLogLocation()
239+
{
240+
string logLocation = String.Empty;
241+
try
242+
{
243+
using (RegistryKey key = GetWSSRegistryKey())
244+
if (key != null)
245+
using (RegistryKey subKey = key.OpenSubKey("WSS"))
246+
if (subKey != null)
247+
logLocation = subKey.GetValue("LogDir") as string;
248+
}
249+
catch (SecurityException) { }
250+
return logLocation;
251+
}
252+
235253
private static string GetSPDiagnosticsLogLocation()
236254
{
237255
string logLocation = String.Empty;
@@ -254,4 +272,4 @@ private static string GetSPDiagnosticsLogLocation()
254272
return logLocation;
255273
}
256274
}
257-
}
275+
}

0 commit comments

Comments
 (0)