In Linux, it is pretty simple to create a .log file:
Create a file using the code given below in the same folder where you have placed your C code.
FILE *fp;
fp = fopen ("data.log", "w");
fprintf(fp, "print this");
Path can also be specified where you want to create your file.
FILE *fp;
fp = fopen ("E://data.log", "w");
fprintf(fp, "print this");
}