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
- In IIS, open the Advanced Settings for the website’s Application Pool.
- 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.
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.
- Right-click on the folder, open Permissions and open the Security tab.
- Edit the permissions to include the Worker Process Identity account with modify access, as shown in the screenshot below.
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 |
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:
- Open the application’s web.config file. See the list of application default folders above for installation defaults.
- 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.
- 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.
- Restart the website’s application pool, and windows service (if applicable). This will re-initialize Log4Net and write to the new log file location.
- 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:
- Un-comment the appender section SmtpAppender.
- 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>
- 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.
- Un-comment and configure optional settings as desired.
- In <root>, un-comment the appender-ref for SmtpAppender. This will enable the email settings that you’ve configured above.
- 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: