OpenStore icon indicating copy to clipboard operation
OpenStore copied to clipboard

Log File Path

Open BenderNETs opened this issue 2 years ago • 24 comments

I recently moved a website including the store to a different web server. The files of the website are now located in a different location. For some reason I receive an exception when I click on the product details. The exception actually happens saying it can't find the log file showing the old local path. Now I need to change the storeLog file location. Where is the path information stored for the storeLog file?

BenderNETs avatar Sep 19 '23 02:09 BenderNETs

Is this the OS xml debugging log files or related to log4net?

A few simple steps you likely already took but just to make sure... Clear the site cache? Restart the application...? Increment the CRM version...? If you think it's OS specific then can go into the BO and you will find the debug mode enabled and outputting file settings that you might try toggling... Just to see if it changes things.

You may also want to search the OS repo for the OutputDebugFile function to see a few places files where there are files being generated. I am pretty sure OS is not managing the actual root path but just concatenating a string to the DNN instance's home directory.

If none of that is helpful you may need to share more details about the error to see if something jumps out.

DNNMonster avatar Sep 19 '23 21:09 DNNMonster

This is the exception. It already fails writing to the log file. The drive changed from d drive to c drive. That's my problem now. Where is that path to the storeLog.txt saved? Is it in a config file or db stored?

System.IO.DirectoryNotFoundException: Could not find a part of the path 'D:\inetpub\wwwroot\DNN\Portals_default\Logs\storeLog.txt'. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) at System.IO.StreamWriter.CreateFile(String path, Boolean append, Boolean checkHost) at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize, Boolean checkHost) at System.IO.StreamWriter..ctor(String path) at Nevoweb.DNN.NBrightBuy.Components.ProductUtils.GetProductData(Int32 productId, Int32 portalId, String lang, Boolean hydrateLists, String typeCode) at Nevoweb.DNN.NBrightBuy.Components.ProductUtils.GetProductData(Int32 productId, String lang, Boolean hydrateLists, String typeCode) at Nevoweb.DNN.NBrightBuy.ProductAjaxView.RazorDisplayDataEntry(String entryId) at Nevoweb.DNN.NBrightBuy.ProductAjaxView.RazorPageLoad() at Nevoweb.DNN.NBrightBuy.ProductAjaxView.OnLoad(EventArgs e)

BenderNETs avatar Sep 20 '23 00:09 BenderNETs

I am not sure about that filename..?? It looks like the standard location for the log4net files generated by DNN, but it seems to have a missing backslash in the path shown in the error message. You may want to check your DotNetNuke.log4net.config and make sure the file element value is right. It may not fix the issue but it's worth a look before chasing anything else.

<file value="Portals/_default/Logs/" />

DNNMonster avatar Sep 20 '23 06:09 DNNMonster

This is how it shows in DotNetNuke.log4net.config However, the store tries to log under 'D:\inetpub\wwwroot\DNN\Portals_default\Logs\storeLog.txt', but there is no D drive. Previously the website was hosted on D drive, but after the move it's no located on C drive. The question is: where is the info stored with the wrong drive letter? Is it coming from any store configuration?

BenderNETs avatar Sep 20 '23 12:09 BenderNETs

look in [dbo].[NBrightBuy] table for an entry with GUIDKey = NBrightBuySettings then in the xmldata check the rootmappath

jasclar avatar Sep 20 '23 12:09 jasclar

I already checked it and a change from d to c drive didn't help. I cleared the cache, restarted DNN, even recycled the app pool, but nothing changed. Still the same exception with the d drive path.

C:\inetpub\wwwroot\DNN</rootmappath>

BenderNETs avatar Sep 20 '23 18:09 BenderNETs

I think it may still be a log4net configuration issue but I'm not sure why it's still showing the D drive unless it's hardcoded some place in a config file. You might share your DotNetNuke.log4net.config if your alright with it otherwise take a look at how this posting shows the usage of static log file naming just to make sure nothing looks amiss. It's not exactly a match to the error you have but potentially relative. It would be worth testing a path with the drive letter specified and see if the error goes away.

https://stackoverflow.com/questions/18063073/how-to-configure-static-log-file-name-with-compositely-named-roll-backups

DNNMonster avatar Sep 20 '23 19:09 DNNMonster

<?xml version="1.0" encoding="utf-8" ?> <log4net> <appender name="RollingFile" type="log4net.Appender.RollingFileAppender"> <file value="Portals/_default/Logs/" /> <datePattern value="yyyy.MM.dd'.log.resources'" /> <rollingStyle value="Date" /> <staticLogFileName value="false" /> <appendToFile value="true" /> <maximumFileSize value="10MB" /> <maxSizeRollBackups value="5" /> <lockingModel type="log4net.Appender.FileAppender+MinimalLock"/> <layout type="log4net.Layout.PatternLayout"> <conversionPattern value="%d{yyyy-MM-dd HH:mm:ss.fffzzz} [%property{log4net:HostName}][C:%property{appdomain}][T:%thread][%level] %logger - %m%n" /> </layout> </appender> <root> <level value="Error" /> <appender-ref ref="RollingFile" /> </root> </log4net>

BenderNETs avatar Sep 20 '23 20:09 BenderNETs

changed to <file value="C:\inetpub\wwwroot\DNN\Portals\_default\Logs\" /> no luck, still the same exception showing the D drive in the path which does not exist.

BenderNETs avatar Sep 21 '23 12:09 BenderNETs

I think the DotNetNuke.log4net.config is correct as I showed earlier since I do see the default DNN logs being created with the file name shown as mentioned in the datePattern. I do see one log file named storeLog.txt in the same folder created and last updated before I moved to the new location. After the move nothing gets saved in that store log file.

BenderNETs avatar Sep 21 '23 12:09 BenderNETs

Maybe permissions..? You might double check that. I'd create the directory if it's not there. Heck maybe the file too.

Maybe another config? Can you find a ref to storeLog.txt some place?

You could try dumping the pertinent vars to your template to see if one is bogus...

DNNMonster avatar Sep 22 '23 19:09 DNNMonster

looked all over. Did a search on the filename in all files. Couldn't find any config with a value of "storeLog.txt" DNN logs work (can see files created every day). The only path that I could find related to the shop was in the database (Table NBrightBuy - GUIDKey: "NBrightBuySettings")

<rootmappath>C:\inetpub\wwwroot\DNN\</rootmappath>

I updated the rootmappath in the XMLData from D to C and I can see the correct path after re-querying.

Permissions are all good. Running out of ideas :(

BenderNETs avatar Sep 22 '23 22:09 BenderNETs

Any plugins? Search your repos too.

DNNMonster avatar Sep 22 '23 23:09 DNNMonster

Have you checked Settings -> Server Settings -> Performance ? ... increment version, switch off minification and composite files. Try with no caching? Is this a child portal? Also running out of ideas

jasclar avatar Sep 23 '23 00:09 jasclar

Tried all options, no luck. This is not a child portal. Only one portal installed. The only plugin installed is "OS_PayPal Payment"

BenderNETs avatar Sep 23 '23 00:09 BenderNETs

Is there anything relevant in your IIS settings, either at the site or the server level, e.g. in Application Settings ?? And have you definitely carefully checked all your .config files in all folders and subfolders, not just the DotNetNuke.log4net.config file at the site top level? (Really struggling to think of anywhere else this would be set)

jasclar avatar Sep 23 '23 00:09 jasclar

Have you tried setting the value to the full path where you have this...

jasclar avatar Sep 23 '23 00:09 jasclar

<file value="Portals/_default/Logs/" />

jasclar avatar Sep 23 '23 00:09 jasclar

The previous server was a Windows Server 2016 (SQL Server Express 2016), moved to Windows Server 2022 (SQL Server Express 2022). I checked all files within the complete DNN folder for "storeLog.txt" through text editor with option "Search in all files". Couldn't find anything. Already tried to change to the full path C:\inetpub\wwwroot\DNN\Portals\_default\Logs\ in both log4net configs (C:\inetpub\wwwroot\DNN\DotNetNuke.log4net.config and C:\inetpub\wwwroot\DNN\Config\DotNetNuke.log4net.config), still no luck

BenderNETs avatar Sep 23 '23 00:09 BenderNETs

Two things:

  1. The log is obviously coming from the online store (storeLog.txt). Any idea where the store configures the log settings? The log4net settings are correct since I do see other log files stored under "Portals/_default/Logs/"
  2. The actual problem is when I try to click on a product to get to the details (see exception I posted earlier). Is the online store always logging this on the details page (this is from the old server with only one log entry "productId: 676; portalId: 0; lang: en-US"), or is there an actual issue and the store tries to log and fails finding the log file.

BenderNETs avatar Sep 23 '23 01:09 BenderNETs

You configure the OS logging in the BO but it's creating xml files in the portals root dir. I am not sure about the storeLog.txt..

I'm still confused by the Portals_default dir which the error shows. It's non standard but I suppose not illicit.

Is the store running a custom ProductDisplayDetail.cshtml?

Anything happening in the razor that might be the culprit?

DNNMonster avatar Sep 25 '23 17:09 DNNMonster

I'm so sorry for all the confusion. I found out that I tested something a few years back and created that log file temporarily (I completely forgot). For some reason that dll was in my backup that I moved over to the new server. After I copied the correct dll over, everything works. Again sorry :(

BenderNETs avatar Sep 25 '23 19:09 BenderNETs

I'm glad that you uncovered the cause and that it was not something more fundamental and worrying in the code. Thank you for letting us know.

jasclar avatar Sep 25 '23 19:09 jasclar

Alright! Sneaky dll's.

DNNMonster avatar Sep 27 '23 05:09 DNNMonster