Logging is recommended for Portals, so each portal includes Log4Net logging. Log4Net logs error information when issues arise in the portals or their supporting services. The instructions below provide an outline of the steps required to ensure logging is properly enabled.

Basic Configuration

Directory Security

In order to write to the log files, Log4Net relies on the Worker Process Identity account to have access to the necessary folders. Directory security must include modify permissions on the Worker Process Identity account. Typically, this account is NETWORKSERVICE, but can be found for a particular portal as described below.

Finding the Worker Process Identity account

  1. In IIS, open the Advanced Settings for the website’s Application Pool.
  2. In the Advanced Settings screen, look under the Process Model Identity field as circled in the screenshot below. This is the account that requires access to the website’s folder.
    B1WebAPI Worker Process Identity.
    B1WebAPI Worker Process Identity.

Applying permissions to the Worker Process Identity account

Once the account is identified, add modify permissions to the logging folder for the Worker Process Identity account.

Below is a list of the default folder locations for each Portal.

  1. Right-click on the folder, open Permissions and open the Security tab.
  2. Edit the permissions to include the Worker Process Identity account with modify access, as shown in the screenshot below.
    Directory Access Control Level.
    Directory Access Control Level.

Portal default logging folder locations

The table below outlines the default locations for application and Log4Net files and folders within each Portal or service.

Portal Default Logging Folder Locations
Portal or Web Service Default Locations

B1WebAPI

Typically installed on the B1 Server.

Default application folder: C:/Program Files (x86)/zedIT/zed B1WebAPI/

Default logging folder:C:/Program Files (x86)/zedIT/zed B1WebAPI/logs/

Default application config file (web.config): C:/Program Files (x86)/zedIT/zed B1WebAPI/web.config

Default Log4Net configuration file:C:/Program Files (x86)/zedIT/zed B1WebAPI/log4net.xml

Customer Portal

Typically installed on the Web Server.

Default application folder: C:/inetpub/wwwroot/zed Customer Portal/

Default logging folder:C:/inetpub/wwwroot/zed Customer Portal/logs/

Default application config file (web.config): C:/inetpub/wwwroot/zed Customer Portal/web.config

Default Log4Net configuration file:C:/inetpub/wwwroot/zed Customer Portal/log4net.xml

Employee Portal

Typically installed on the Web Server.

Default application folder: C:/Program Files (x86)/zedIT/zed Employee Portal/

Default logging folder:C:/Program Files (x86)/zedIT/zed Employee Portal/logs/

Default application configuration file (web.config): C:/Program Files (x86)/zedIT/zed Employee Portal/web.config

Default Log4Net configuration file:C:/Program Files (x86)/zedIT/zed Employee Portal/log4net.xml

Expense Service for Employee Portal

Installed as a sub-folder of the base Employee Portal website.

Default application folder: C:/Program Files (x86)/zedIT/zed Employee Portal/service/

Default logging folder:C:/Program Files (x86)/zedIT/zed Employee Portal/service/logs/

Default service config file (ExpensePortalService.exe.config): C:/Program Files (x86)/zedIT/zed Employee Portal/service/ExpensePortalService.exe.config

Default Log4Net configuration file:C:/Program Files (x86)/zedIT/zed Employee Portal/service/Config/log4net.xml

Vendor Portal

Typically installed on the Web Server.

Default application folder: C:/Program Files (x86)/zedIT/zed Vendor Portal/

Default logging folder:C:/Program Files (x86)/zedIT/zed Vendor Portal/logs/

Default application configuration file (web.config): C:/Program Files (x86)/zedIT/zed Vendor Portal/web.config

Default Log4Net configuration file:C:/Program Files (x86)/zedIT/zed Vendor Portal/log4net.xml

Workflow Portal

Typically installed on the B1 Server.

Default application folder: C:/Program Files (x86)/zedIT/zed Workflow Portal/

Default logging folder:C:/Program Files (x86)/zedIT/zed Workflow Portal/logs/

Default application configuration file (web.config): C:/Program Files (x86)/zedIT/zed Workflow Portal/web.config

Default Log4Net configuration file:C:/Program Files (x86)/zedIT/zed Workflow Portal/log4net.xml

Workflow Service for Workflow Portal

Installed as a sub-folder of the Workflow Portal website.

Default application folder: C:/Program Files (x86)/zedIT/zed Workflow Portal/service/

Default logging folder:C:/Program Files (x86)/zedIT/zed Workflow Portal/service/logs/

Default service configuration file (B1WorkFlowService.exe.config): C:/Program Files (x86)/zedIT/zed Workflow Portal/service/B1WorkFlowService.exe.config

Default Log4Net configuration file:C:/Program Files (x86)/zedIT/zed Workflow Portal/service/B1WorkFlowService.exe.config (look for the <log4net> section of this config file)

Advanced Configuration

Changing default logging locations

By default, Log4Net uses the locations listed above for each application. These locations can be changed by modifying each application’s or service’s web.config file. Note that this must be done separately for each installation of each application and service. This is because each application’s web.config file is independent from other installations.

To change the default logging location:

  1. Open the application’s web.config file. See the list of application default folders above for installation defaults.
  2. Edit the logging details in the web.config file. Look for the section <appSettings> and make the following edits:
    • LogFileName: This is the name of the Log4Net configuration file. It is generally log4net.xml which is the default value and therefore does not typically need to be changed.
    • LogFileDir: This is the full path to the folder which contains the log4net configuration file. It defaults to Config which is a sub-folder to the service folder. Unless fully qualified, this is assumed to be local path based on the current service executable’s file location. This value should also generally not need to be changed.
  3. Change the file path in the logging configuration file. These details are found in the file specified by the LogFileName in the web.config file, which was edited in the previous step. Make the following changes to the RollingFile appender, as desired:
    • file: Denotes which file to append log details into.
    • appendToFile: [true|false]
    • maximumFileSize: Once the file reaches this size, a new file will be created.
    • layout: determines the layout of the logging details that are appended to the file.
  4. Restart the website’s application pool, and windows service (if applicable). This will re-initialize Log4Net and write to the new log file location.
  5. Verify that the restart has been logged by opening the logging file in the new location.

Enable logging emails

In addition to saving logging details to a file on the server, logging summary emails can optionally be sent via Log4Net. To enable emails, edit the Log4Net config file (specified in the application’s or service’s config file, as described above). Edit the config file in the following way:

  1. Un-comment the appender section SmtpAppender.
  2. Edit the to address, from address, subject, and host, similar to the following:
    <appender name="SmtpAppender" type="log4net.Appender.SmtpAppender,log4net">
       <to value="samplecustomer@customercompany.com" />
       <from value="support@yourcompany.com" />
       <subject value="zed B1 Query Portal" />
       <smtpHost value="smtp_servername" />
       <!-- ... other settings ... -->
    </appender>
    
  3. Un-comment the evaluator and layout sections. Set the evaluator threshold to DEBUG for more verbose logging, or leave it as ERROR to only receive error logging.
  4. Un-comment and configure optional settings as desired.
  5. In <root>, un-comment the appender-ref for SmtpAppender. This will enable the email settings that you’ve configured above.
  6. Recycle the website’s application pool and windows service (if applicable) to apply the new email logging.

What’s Next?

Once installation and basic configuration has been applied, the system is ready for advanced configuration. For more information, visit the Administrator’s Guides: