A log file or LDF(Log Database File) is a database file of Microsoft SQL Server, which stores all the transaction logs/events, which executes on the database. The main purpose of using log file in SQL Server is to rollback the database in case of data loss. Log file uses the same filename as its associated MDF file. The file extension for this file is .ldf.
LDF file is a kind of Log database file.
Hex: 01 0F 00 00 08 , ASCII
The default location of .ldf file depends on its SQL Server version.
C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\
C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\
C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\
C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\
C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\
C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\DATA\
The LDF file can be opened using SQL Command Line Program. Each transaction or rollback command has different syntax for each LDF files.